diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 0000000000..ec2953a161 --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,11 @@ +reviews: + path_filters: + - "!app/config/specs/**" + - "!docs/examples/**" + - "!docs/references/**" + - "!docs/sdks/**" + auto_review: + base_branches: + - main + - 1.6.x + - 1.7.x \ No newline at end of file diff --git a/.env b/.env index 89b76cb740..4980315c9a 100644 --- a/.env +++ b/.env @@ -19,11 +19,14 @@ _APP_CUSTOM_DOMAIN_DENY_LIST= _APP_OPTIONS_ABUSE=disabled _APP_OPTIONS_ROUTER_PROTECTION=disabled _APP_OPTIONS_FORCE_HTTPS=disabled -_APP_OPTIONS_FUNCTIONS_FORCE_HTTPS=disabled +_APP_OPTIONS_ROUTER_FORCE_HTTPS=disabled _APP_OPENSSL_KEY_V1=your-secret-key _APP_DOMAIN=traefik _APP_DOMAIN_FUNCTIONS=functions.localhost -_APP_DOMAIN_TARGET=localhost +_APP_DOMAIN_SITES=sites.localhost +_APP_DOMAIN_TARGET_CNAME=test.appwrite.io +_APP_DOMAIN_TARGET_A=127.0.0.1 +_APP_DOMAIN_TARGET_AAAA=::1 _APP_RULES_FORMAT=md5 _APP_REDIS_HOST=redis _APP_REDIS_PORT=6379 @@ -70,17 +73,19 @@ _APP_SMS_FROM=+123456789 _APP_SMS_PROJECTS_DENY_LIST= _APP_STORAGE_LIMIT=30000000 _APP_STORAGE_PREVIEW_LIMIT=20000000 -_APP_FUNCTIONS_SIZE_LIMIT=30000000 +_APP_COMPUTE_SIZE_LIMIT=30000000 _APP_FUNCTIONS_TIMEOUT=900 -_APP_FUNCTIONS_BUILD_TIMEOUT=900 -_APP_FUNCTIONS_CPUS=8 -_APP_FUNCTIONS_MEMORY=8192 -_APP_FUNCTIONS_INACTIVE_THRESHOLD=600 -_APP_FUNCTIONS_MAINTENANCE_INTERVAL=600 -_APP_FUNCTIONS_RUNTIMES_NETWORK=runtimes +_APP_SITES_TIMEOUT=30 +_APP_COMPUTE_BUILD_TIMEOUT=900 +_APP_COMPUTE_CPUS=8 +_APP_COMPUTE_MEMORY=8192 +_APP_COMPUTE_INACTIVE_THRESHOLD=600 +_APP_COMPUTE_MAINTENANCE_INTERVAL=600 +_APP_COMPUTE_RUNTIMES_NETWORK=runtimes _APP_EXECUTOR_SECRET=your-secret-key -_APP_EXECUTOR_HOST=http://proxy/v1 +_APP_EXECUTOR_HOST=http://exc1/v1 _APP_FUNCTIONS_RUNTIMES=php-8.0,node-18.0,python-3.9,ruby-3.1 +_APP_SITES_RUNTIMES=static-1,node-22,flutter-3.29 _APP_MAINTENANCE_INTERVAL=86400 _APP_MAINTENANCE_START_TIME=12:00 _APP_MAINTENANCE_RETENTION_CACHE=2592000 @@ -89,7 +94,7 @@ _APP_MAINTENANCE_RETENTION_ABUSE=86400 _APP_MAINTENANCE_RETENTION_AUDIT=1209600 _APP_MAINTENANCE_RETENTION_AUDIT_CONSOLE=15778800 _APP_USAGE_AGGREGATION_INTERVAL=30 -_APP_STATS_RESOURCES_INTERVAL=3600 +_APP_STATS_RESOURCES_INTERVAL=30 _APP_MAINTENANCE_RETENTION_USAGE_HOURLY=8640000 _APP_MAINTENANCE_RETENTION_SCHEDULES=86400 _APP_USAGE_STATS=enabled diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000000..6d73787d00 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,120 @@ +name: Benchmark +concurrency: + group: '${{ github.workflow }}-${{ github.ref }}' + cancel-in-progress: true +env: + IMAGE: appwrite-dev + CACHE_KEY: 'appwrite-dev-${{ github.event.pull_request.head.sha }}' +'on': + - pull_request +jobs: + setup: + name: Setup & Build Appwrite Image + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Build Appwrite + uses: docker/build-push-action@v6 + with: + context: . + push: false + tags: '${{ env.IMAGE }}' + load: true + cache-from: type=gha + cache-to: 'type=gha,mode=max' + outputs: 'type=docker,dest=/tmp/${{ env.IMAGE }}.tar' + build-args: | + DEBUG=false + TESTING=true + VERSION=dev + - name: Cache Docker Image + uses: actions/cache@v4 + with: + key: '${{ env.CACHE_KEY }}' + path: '/tmp/${{ env.IMAGE }}.tar' + benchmarking: + name: Benchmark + runs-on: ubuntu-latest + needs: setup + permissions: + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Load Cache + uses: actions/cache@v4 + with: + key: '${{ env.CACHE_KEY }}' + path: '/tmp/${{ env.IMAGE }}.tar' + fail-on-cache-miss: true + - name: Load and Start Appwrite + run: | + sed -i 's/traefik/localhost/g' .env + docker load --input /tmp/${{ env.IMAGE }}.tar + docker compose up -d + sleep 10 + - name: Install Oha + run: | + echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ stable main" | sudo tee /etc/apt/sources.list.d/azlux.list + sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg + sudo apt update + sudo apt install oha + - name: Benchmark PR + run: 'oha -z 180s http://localhost/v1/health/version -j > benchmark.json' + - name: Cleaning + run: docker compose down -v + - name: Installing latest version + run: | + rm docker-compose.yml + rm .env + curl https://appwrite.io/install/compose -o docker-compose.yml + curl https://appwrite.io/install/env -o .env + sed -i 's/_APP_OPTIONS_ABUSE=enabled/_APP_OPTIONS_ABUSE=disabled/g' .env + docker compose up -d + sleep 10 + - name: Benchmark Latest + run: oha -z 180s http://localhost/v1/health/version -j > benchmark-latest.json + - name: Prepare comment + run: | + echo '## :sparkles: Benchmark results' > benchmark.txt + echo ' ' >> benchmark.txt + echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber?|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json)" >> benchmark.txt + echo "- Requests with 200 status code: $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json)" >> benchmark.txt + echo "- P99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt + echo " " >> benchmark.txt + echo " " >> benchmark.txt + echo "## :zap: Benchmark Comparison" >> benchmark.txt + echo " " >> benchmark.txt + echo "| Metric | This PR | Latest version | " >> benchmark.txt + echo "| --- | --- | --- | " >> benchmark.txt + echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark-latest.json) | " >> benchmark.txt + echo "| 200 | $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark-latest.json) | " >> benchmark.txt + echo "| P99 | $(jq -r '.latencyPercentiles.p99' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | " >> benchmark.txt + - name: Save results + uses: actions/upload-artifact@v4 + if: '${{ !cancelled() }}' + with: + name: benchmark.json + path: benchmark.json + retention-days: 7 + - name: Find Comment + if: github.event.pull_request.head.repo.full_name == github.repository + uses: peter-evans/find-comment@v3 + id: fc + with: + issue-number: '${{ github.event.pull_request.number }}' + comment-author: 'github-actions[bot]' + body-includes: Benchmark results + - name: Comment on PR + if: github.event.pull_request.head.repo.full_name == github.repository + uses: peter-evans/create-or-update-comment@v4 + with: + comment-id: '${{ steps.fc.outputs.comment-id }}' + issue-number: '${{ github.event.pull_request.number }}' + body-path: benchmark.txt + edit-mode: replace diff --git a/.github/workflows/cleanup-cache.yml b/.github/workflows/cleanup-cache.yml index 6e20b8f879..8f25fe5ef6 100644 --- a/.github/workflows/cleanup-cache.yml +++ b/.github/workflows/cleanup-cache.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cleanup run: | diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0c0482ca8f..a40f07ceda 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -34,7 +34,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # We must fetch at least the immediate parents so that if this is # a pull request then we can checkout the head. diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 899c27a135..02edd57923 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0ed82dd853..c78156ca04 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,7 +12,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 submodules: recursive diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 712d30dac0..862d669466 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # We must fetch at least the immediate parents so that if this is # a pull request then we can checkout the head. diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 0000000000..04f8c822c7 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,16 @@ +name: "Static code analysis" + +on: [pull_request] +jobs: + lint: + name: CodeQL + runs-on: ubuntu-latest + + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Run CodeQL + run: | + docker run --rm -v $PWD:/app composer:2.6 sh -c \ + "composer install --profile --ignore-platform-reqs && composer check" \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1d35fec3c7..6fd4e89858 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -90,6 +90,9 @@ jobs: docker compose up -d sleep 10 + - name: Logs + run: docker compose logs appwrite + - name: Doctor run: docker compose exec -T appwrite doctor @@ -119,6 +122,14 @@ jobs: docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d sleep 10 + + - name: Wait for Open Runtimes + timeout-minutes: 3 + run: | + while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + echo "Waiting for Executor to come online" + sleep 1 + done - name: Run General Tests run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/General --debug @@ -142,7 +153,10 @@ jobs: Locale, Projects, Realtime, + Sites, + Proxy, Storage, + Tokens, Teams, Users, Webhooks, @@ -167,6 +181,14 @@ jobs: docker compose up -d sleep 30 + - name: Wait for Open Runtimes + timeout-minutes: 3 + run: | + while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + echo "Waiting for Executor to come online" + sleep 1 + done + - name: Run ${{ matrix.service }} tests with Project table mode run: | echo "Using project tables" @@ -176,7 +198,7 @@ jobs: docker compose exec -T \ -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ - appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug + appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude=devKeys e2e_shared_mode_test: name: E2E Shared Mode Service Test @@ -199,13 +221,16 @@ jobs: Locale, Projects, Realtime, + Sites, + Proxy, Storage, Teams, Users, Webhooks, VCS, Messaging, - Migrations + Migrations, + Tokens ] tables-mode: [ 'Shared V1', @@ -229,6 +254,14 @@ jobs: docker compose up -d sleep 30 + - name: Wait for Open Runtimes + timeout-minutes: 3 + run: | + while ! docker compose logs openruntimes-executor | grep -q "Executor is ready."; do + echo "Waiting for Executor to come online" + sleep 1 + done + - name: Run ${{ matrix.service }} tests with ${{ matrix.tables-mode }} table mode run: | if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then @@ -240,90 +273,90 @@ jobs: export _APP_DATABASE_SHARED_TABLES=database_db_main export _APP_DATABASE_SHARED_TABLES_V1= fi - + docker compose exec -T \ -e _APP_DATABASE_SHARED_TABLES \ -e _APP_DATABASE_SHARED_TABLES_V1 \ - appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug + appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude=devKeys - benchmarking: - name: Benchmark + e2e_dev_keys: + name: E2E Service Test (Dev Keys) runs-on: ubuntu-latest needs: setup - permissions: - pull-requests: write + strategy: + fail-fast: false steps: - - name: Checkout repository + - name: checkout uses: actions/checkout@v4 + - name: Load Cache uses: actions/cache@v4 with: key: ${{ env.CACHE_KEY }} path: /tmp/${{ env.IMAGE }}.tar fail-on-cache-miss: true + - name: Load and Start Appwrite run: | - sed -i 's/traefik/localhost/g' .env - docker load --input /tmp/${{ env.IMAGE }}.tar + docker load --input /tmp/${{ env.IMAGE }}.tar + sed -i 's/_APP_OPTIONS_ABUSE=disabled/_APP_OPTIONS_ABUSE=enabled/' .env docker compose up -d - sleep 10 - - name: Install Oha + sleep 30 + + - name: Run Projects tests with dev keys in dedicated table mode run: | - echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ stable main" | sudo tee /etc/apt/sources.list.d/azlux.list - sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg - sudo apt update - sudo apt install oha - - name: Benchmark PR - run: oha -z 180s http://localhost/v1/health/version -j > benchmark.json - - name: Cleaning - run: docker compose down -v - - name: Installing latest version + echo "Using project tables" + export _APP_DATABASE_SHARED_TABLES= + export _APP_DATABASE_SHARED_TABLES_V1= + + docker compose exec -T \ + -e _APP_DATABASE_SHARED_TABLES \ + -e _APP_DATABASE_SHARED_TABLES_V1 \ + appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=devKeys + + e2e_dev_keys_shared_mode: + name: E2E Shared Mode Service Test (Dev Keys) + runs-on: ubuntu-latest + needs: [ setup, check_database_changes ] + if: needs.check_database_changes.outputs.database_changed == 'true' + strategy: + fail-fast: false + matrix: + tables-mode: [ + 'Shared V1', + 'Shared V2', + ] + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: Load Cache + uses: actions/cache@v4 + with: + key: ${{ env.CACHE_KEY }} + path: /tmp/${{ env.IMAGE }}.tar + fail-on-cache-miss: true + + - name: Load and Start Appwrite run: | - rm docker-compose.yml - rm .env - curl https://appwrite.io/install/compose -o docker-compose.yml - curl https://appwrite.io/install/env -o .env - sed -i 's/_APP_OPTIONS_ABUSE=enabled/_APP_OPTIONS_ABUSE=disabled/g' .env + docker load --input /tmp/${{ env.IMAGE }}.tar + sed -i 's/_APP_OPTIONS_ABUSE=disabled/_APP_OPTIONS_ABUSE=enabled/' .env docker compose up -d - sleep 10 - - name: Benchmark Latest - run: oha -z 180s http://localhost/v1/health/version -j > benchmark-latest.json - - name: Prepare comment + sleep 30 + + - name: Run Projects tests with dev keys in ${{ matrix.tables-mode }} table mode run: | - echo '## :sparkles: Benchmark results' > benchmark.txt - echo ' ' >> benchmark.txt - echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber?|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json)" >> benchmark.txt - echo "- Requests with 200 status code: $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json)" >> benchmark.txt - echo "- P99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt - echo " " >> benchmark.txt - echo " " >> benchmark.txt - echo "## :zap: Benchmark Comparison" >> benchmark.txt - echo " " >> benchmark.txt - echo "| Metric | This PR | Latest version | " >> benchmark.txt - echo "| --- | --- | --- | " >> benchmark.txt - echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark-latest.json) | " >> benchmark.txt - echo "| 200 | $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark-latest.json) | " >> benchmark.txt - echo "| P99 | $(jq -r '.latencyPercentiles.p99' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | " >> benchmark.txt - - name: Save results - uses: actions/upload-artifact@v4 - if: ${{ !cancelled() }} - with: - name: benchmark.json - path: benchmark.json - retention-days: 7 - - name: Find Comment - if: github.event.pull_request.head.repo.full_name == github.repository - uses: peter-evans/find-comment@v3 - id: fc - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: 'github-actions[bot]' - body-includes: Benchmark results - - name: Comment on PR - if: github.event.pull_request.head.repo.full_name == github.repository - uses: peter-evans/create-or-update-comment@v4 - with: - comment-id: ${{ steps.fc.outputs.comment-id }} - issue-number: ${{ github.event.pull_request.number }} - body-path: benchmark.txt - edit-mode: replace + if [ "${{ matrix.tables-mode }}" == "Shared V1" ]; then + echo "Using shared tables V1" + export _APP_DATABASE_SHARED_TABLES=database_db_main + export _APP_DATABASE_SHARED_TABLES_V1=database_db_main + elif [ "${{ matrix.tables-mode }}" == "Shared V2" ]; then + echo "Using shared tables V2" + export _APP_DATABASE_SHARED_TABLES=database_db_main + export _APP_DATABASE_SHARED_TABLES_V1= + fi + + docker compose exec -T \ + -e _APP_DATABASE_SHARED_TABLES \ + -e _APP_DATABASE_SHARED_TABLES_V1 \ + appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=devKeys diff --git a/.gitignore b/.gitignore index 0c19fd215e..600a6aeb08 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /node_modules/ /tests/resources/storage/ /tests/resources/functions/**/code.tar.gz +/tests/resources/sites/**/code.tar.gz /app/sdks/* /.idea/ !/.idea/workspace.xml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index df88cfcfb9..7746ef99af 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -163,6 +163,28 @@ Other containes should be named the same as their service, for example `redis` s - [Encryption](https://medium.com/searchencrypt/what-is-encryption-how-does-it-work-e8f20e340537#:~:text=Encryption%20is%20a%20process%20that,%2C%20or%20decrypt%2C%20the%20information.) - [Hashing](https://searchsqlserver.techtarget.com/definition/hashing#:~:text=Hashing%20is%20the%20transformation%20of,it%20using%20the%20original%20value.) +## Modules + +As Appwrite grows, we noticed approach of having all service endpoints in `app/controllers/api/[service].php` is not maintainable. Not only it creates massive files, it also doesnt contain all product's features such as workers or tasks. While there might still be some occurances of those controller files, we avoid it in all new development, and gradually migrate existing controllers to **HTTP modules**. + +### HTTP Endpoints + +Every endpoint file follows below structure, making it consistent with HTTP REST endpoint path: + +``` +src/Appwrite/Platform/Modules/[service]/Http/[resource]/[action].php +``` + +Tips and tricks: + +1. If endpoint doesn't have resource, use service name as resource name too +> Example: `Modules/Sites/Http/Sites/Get.php` + +2. If there are multiple resources, use then all in folder structure +> Example: `Modules/Sites/Http/Deployments/Builds/Create.php` + +3. Action can only be `Get`, `Create`, `Update`, `Delete` or `XList` + ## Architecture Appwrite's current structure is a combination of both [Monolithic](https://en.wikipedia.org/wiki/Monolithic_application) and [Microservice](https://en.wikipedia.org/wiki/Microservices) architectures. diff --git a/Dockerfile b/Dockerfile index 2f1ea6f279..30b017b573 100755 --- a/Dockerfile +++ b/Dockerfile @@ -44,12 +44,14 @@ COPY ./dev /usr/src/code/dev # Set Volumes RUN mkdir -p /storage/uploads && \ + mkdir -p /storage/imports && \ mkdir -p /storage/cache && \ mkdir -p /storage/config && \ mkdir -p /storage/certificates && \ mkdir -p /storage/functions && \ mkdir -p /storage/debug && \ chown -Rf www-data.www-data /storage/uploads && chmod -Rf 0755 /storage/uploads && \ + chown -Rf www-data.www-data /storage/imports && chmod -Rf 0755 /storage/imports && \ chown -Rf www-data.www-data /storage/cache && chmod -Rf 0755 /storage/cache && \ chown -Rf www-data.www-data /storage/config && chmod -Rf 0755 /storage/config && \ chown -Rf www-data.www-data /storage/certificates && chmod -Rf 0755 /storage/certificates && \ @@ -68,6 +70,7 @@ RUN chmod +x /usr/local/bin/doctor && \ chmod +x /usr/local/bin/sdks && \ chmod +x /usr/local/bin/specs && \ chmod +x /usr/local/bin/ssl && \ + chmod +x /usr/local/bin/screenshot && \ chmod +x /usr/local/bin/test && \ chmod +x /usr/local/bin/upgrade && \ chmod +x /usr/local/bin/vars && \ diff --git a/README-CN.md b/README-CN.md index a81d99c3c3..c79e0a1db4 100644 --- a/README-CN.md +++ b/README-CN.md @@ -72,7 +72,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.6.2 + appwrite/appwrite:1.7.0 ``` ### Windows @@ -84,7 +84,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.6.2 + appwrite/appwrite:1.7.0 ``` #### PowerShell @@ -94,7 +94,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.6.2 + appwrite/appwrite:1.7.0 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index e8986e075f..435a2efd87 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.6.2 + appwrite/appwrite:1.7.0 ``` ### Windows @@ -90,7 +90,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.6.2 + appwrite/appwrite:1.7.0 ``` #### PowerShell @@ -100,7 +100,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.6.2 + appwrite/appwrite:1.7.0 ``` Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation. diff --git a/app/cli.php b/app/cli.php index 9ade97e90c..0f0e48bf7d 100644 --- a/app/cli.php +++ b/app/cli.php @@ -30,8 +30,8 @@ use Utopia\Telemetry\Adapter\None as NoTelemetry; use function Swoole\Coroutine\run; -// Overwriting runtimes to be architecture agnostic for CLI -Config::setParam('runtimes', (new Runtimes('v4'))->getAll(supported: false)); +// overwriting runtimes to be architecture agnostic for CLI +Config::setParam('runtimes', (new Runtimes('v5'))->getAll(supported: false)); // require controllers after overwriting runtimes require_once __DIR__ . '/controllers/general.php'; diff --git a/app/config/collections/common.php b/app/config/collections/common.php index 8ca1d91b67..e77d5403d2 100644 --- a/app/config/collections/common.php +++ b/app/config/collections/common.php @@ -1101,6 +1101,28 @@ return [ 'array' => false, 'filters' => ['json', 'encrypt'], ], + [ + '$id' => ID::custom('scopes'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => true, + 'filters' => [], + ], + [ + '$id' => ID::custom('expire'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'required' => false, + 'signed' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], ], 'indexes' => [ [ @@ -1417,6 +1439,13 @@ return [ 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], + [ + '$id' => ID::custom('_key_roles'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['roles'], + 'lengths' => [128], + 'orders' => [], + ], ], ], diff --git a/app/config/collections/platform.php b/app/config/collections/platform.php index ccb87f06b3..60f181df66 100644 --- a/app/config/collections/platform.php +++ b/app/config/collections/platform.php @@ -225,7 +225,7 @@ return [ '$id' => ID::custom('templates'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 1000000, // TODO make sure size fits + 'size' => 1_000_000, // TODO make sure size fits 'signed' => true, 'required' => false, 'default' => [], @@ -287,6 +287,17 @@ return [ 'array' => false, 'filters' => ['subQueryKeys'], ], + [ + '$id' => ID::custom('devKeys'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['subQueryDevKeys'], + ], [ '$id' => ID::custom('search'), 'type' => Database::VAR_STRING, @@ -717,6 +728,107 @@ return [ ], ], + 'devKeys' => [ + '$collection' => ID::custom(Database::METADATA), + '$id' => ID::custom('devKeys'), + 'name' => 'Dev keys', + 'attributes' => [ + [ + '$id' => ID::custom('projectInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('projectId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => 0, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('name'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('secret'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 512, // var_dump of \bin2hex(\random_bytes(128)) => string(256) doubling for encryption + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => ['encrypt'], + ], + [ + '$id' => ID::custom('expire'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('accessedAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('sdks'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => true, + 'filters' => [], + ], + ], + 'indexes' => [ + [ + '$id' => ID::custom('_key_project'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['projectInternalId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => '_key_accessedAt', + 'type' => Database::INDEX_KEY, + 'attributes' => ['accessedAt'], + 'lengths' => [], + 'orders' => [], + ], + ], + ], + 'webhooks' => [ '$collection' => ID::custom(Database::METADATA), '$id' => ID::custom('webhooks'), @@ -1041,21 +1153,10 @@ return [ 'filters' => [], ], [ - '$id' => ID::custom('resourceType'), + '$id' => ID::custom('type'), // 'api', 'redirect', 'deployment' (site or function) 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 100, - 'signed' => true, - 'required' => true, - 'default' => null, - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('resourceInternalId'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => Database::LENGTH_KEY, + 'size' => 32, 'signed' => true, 'required' => false, 'default' => null, @@ -1063,13 +1164,101 @@ return [ 'filters' => [], ], [ - '$id' => ID::custom('resourceId'), + '$id' => ID::custom('trigger'), // 'manual', 'deployment', '' (empty) + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 32, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('redirectUrl'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 2048, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('redirectStatusCode'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentResourceType'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 32, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentId'), 'type' => Database::VAR_STRING, 'format' => '', 'size' => Database::LENGTH_KEY, 'signed' => true, 'required' => false, - 'default' => null, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentResourceId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentResourceInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentVcsProviderBranch'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => '', 'array' => false, 'filters' => [], ], @@ -1095,6 +1284,17 @@ return [ 'array' => false, 'filters' => [], ], + [ + '$id' => ID::custom('search'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], [ '$id' => ID::custom('owner'), 'type' => Database::VAR_STRING, @@ -1119,6 +1319,13 @@ return [ ], ], 'indexes' => [ + [ + '$id' => ID::custom('_key_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [], + ], [ '$id' => ID::custom('_key_domain'), 'type' => Database::INDEX_UNIQUE, @@ -1141,24 +1348,59 @@ return [ 'orders' => [Database::ORDER_ASC], ], [ - '$id' => '_key_resourceInternalId', + '$id' => '_key_type', 'type' => Database::INDEX_KEY, - 'attributes' => ['resourceInternalId'], + 'attributes' => ['type'], + 'lengths' => [32], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => '_key_trigger', + 'type' => Database::INDEX_KEY, + 'attributes' => ['trigger'], + 'lengths' => [32], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => '_key_deploymentResourceType', + 'type' => Database::INDEX_KEY, + 'attributes' => ['deploymentResourceType'], + 'lengths' => [32], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => '_key_deploymentResourceId', + 'type' => Database::INDEX_KEY, + 'attributes' => ['deploymentResourceId'], 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], ], [ - '$id' => '_key_resourceId', + '$id' => '_key_deploymentResourceInternalId', 'type' => Database::INDEX_KEY, - 'attributes' => ['resourceId'], + 'attributes' => ['deploymentResourceInternalId'], 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], ], [ - '$id' => '_key_resourceType', + '$id' => '_key_deploymentId', 'type' => Database::INDEX_KEY, - 'attributes' => ['resourceType'], - 'lengths' => [], + 'attributes' => ['deploymentId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => '_key_deploymentInternalId', + 'type' => Database::INDEX_KEY, + 'attributes' => ['deploymentInternalId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => '_key_deploymentVcsProviderBranch', + 'type' => Database::INDEX_KEY, + 'attributes' => ['deploymentVcsProviderBranch'], + 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], ], [ @@ -1178,7 +1420,7 @@ return [ [ '$id' => ID::custom('_key_piid_riid_rt'), 'type' => Database::INDEX_KEY, - 'attributes' => ['projectInternalId', 'resourceInternalId', 'resourceType'], + 'attributes' => ['projectInternalId', 'deploymentInternalId', 'deploymentResourceType'], 'lengths' => [], 'orders' => [], ], @@ -1648,5 +1890,5 @@ return [ 'name' => 'vcsCommentLocks', 'attributes' => [], 'indexes' => [] - ] + ], ]; diff --git a/app/config/collections/projects.php b/app/config/collections/projects.php index 4844ad16d3..48a0938a1c 100644 --- a/app/config/collections/projects.php +++ b/app/config/collections/projects.php @@ -569,7 +569,7 @@ return [ 'filters' => [], ], [ - '$id' => ID::custom('deployment'), + '$id' => ID::custom('deploymentId'), 'type' => Database::VAR_STRING, 'format' => '', 'size' => Database::LENGTH_KEY, @@ -579,6 +579,61 @@ return [ 'array' => false, 'filters' => [], ], + [ + '$id' => ID::custom('deploymentCreatedAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('latestDeploymentId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('latestDeploymentInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('latestDeploymentCreatedAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('latestDeploymentStatus'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], [ '$id' => ID::custom('vars'), 'type' => Database::VAR_STRING, @@ -674,7 +729,7 @@ return [ 'size' => 8, 'signed' => true, 'required' => false, - 'default' => 'v4', + 'default' => 'v5', 'array' => false, 'filters' => [], ], @@ -708,7 +763,7 @@ return [ 'size' => 128, 'signed' => false, 'required' => false, - 'default' => APP_FUNCTION_SPECIFICATION_DEFAULT, + 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, 'filters' => [], ], [ @@ -788,15 +843,449 @@ return [ 'orders' => [Database::ORDER_ASC], ], [ - '$id' => ID::custom('_key_deployment'), + '$id' => ID::custom('_key_deploymentId'), 'type' => Database::INDEX_KEY, - 'attributes' => ['deployment'], + 'attributes' => ['deploymentId'], 'lengths' => [], 'orders' => [Database::ORDER_ASC], ] ], ], + 'sites' => [ + '$collection' => ID::custom(Database::METADATA), + '$id' => ID::custom('sites'), + 'name' => 'Sites', + 'attributes' => [ + [ + '$id' => ID::custom('name'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 2048, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('enabled'), + 'type' => Database::VAR_BOOLEAN, + 'signed' => true, + 'size' => 0, + 'format' => '', + 'filters' => [], + 'required' => true, + 'array' => false, + ], + [ + '$id' => ID::custom('live'), + 'type' => Database::VAR_BOOLEAN, + 'signed' => true, + 'size' => 0, + 'format' => '', + 'filters' => [], + 'required' => true, + 'array' => false, + ], + [ + '$id' => ID::custom('installationId'), + 'type' => Database::VAR_STRING, + 'signed' => true, + 'size' => Database::LENGTH_KEY, + 'format' => '', + 'filters' => [], + 'required' => false, + 'array' => false, + ], + [ + '$id' => ID::custom('installationInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('providerRepositoryId'), + 'type' => Database::VAR_STRING, + 'signed' => true, + 'size' => Database::LENGTH_KEY, + 'format' => '', + 'filters' => [], + 'required' => false, + 'array' => false, + ], + [ + '$id' => ID::custom('repositoryId'), + 'type' => Database::VAR_STRING, + 'signed' => true, + 'size' => Database::LENGTH_KEY, + 'format' => '', + 'filters' => [], + 'required' => false, + 'array' => false, + ], + [ + '$id' => ID::custom('repositoryInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('providerBranch'), + 'type' => Database::VAR_STRING, + 'signed' => true, + 'size' => Database::LENGTH_KEY, + 'format' => '', + 'filters' => [], + 'required' => false, + 'array' => false, + ], + [ + '$id' => ID::custom('providerRootDirectory'), + 'type' => Database::VAR_STRING, + 'signed' => true, + 'size' => Database::LENGTH_KEY, + 'format' => '', + 'filters' => [], + 'required' => false, + 'array' => false, + ], + [ + '$id' => ID::custom('providerSilentMode'), + 'type' => Database::VAR_BOOLEAN, + 'signed' => true, + 'size' => 0, + 'format' => '', + 'filters' => [], + 'required' => false, + 'default' => false, + 'array' => false, + ], + [ + '$id' => ID::custom('logging'), + 'type' => Database::VAR_BOOLEAN, + 'signed' => true, + 'size' => 0, + 'format' => '', + 'filters' => [], + 'required' => true, + 'array' => false, + ], + [ + '$id' => ID::custom('framework'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 2048, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + 'array' => false, + '$id' => ID::custom('outputDirectory'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'filters' => [], + ], + [ + 'array' => false, + '$id' => ID::custom('buildCommand'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'filters' => [], + ], + [ + 'array' => false, + '$id' => ID::custom('installCommand'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'filters' => [], + ], + [ + '$id' => ID::custom('fallbackFile'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentCreatedAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('deploymentScreenshotLight'), // File ID from 'screenshots' Console bucket + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 32, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('deploymentScreenshotDark'), // File ID from 'screenshots' Console bucket + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 32, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('latestDeploymentId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('latestDeploymentInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('latestDeploymentCreatedAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('latestDeploymentStatus'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('vars'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['subQueryVariables'], + ], + [ + '$id' => ID::custom('varsProject'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['subQueryProjectVariables'], + ], + [ + '$id' => ID::custom('timeout'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('search'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + 'array' => false, + '$id' => ID::custom('specification'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 128, + 'signed' => false, + 'required' => false, + 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, + 'filters' => [], + ], + [ + '$id' => ID::custom('buildRuntime'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 2048, + 'signed' => true, + 'required' => true, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('adapter'), // ssr or static; named this way as it's a term in SSR frameworks + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + ], + 'indexes' => [ + [ + '$id' => ID::custom('_key_search'), + 'type' => Database::INDEX_FULLTEXT, + 'attributes' => ['search'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_name'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['name'], + 'lengths' => [256], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_enabled'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['enabled'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_installationId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['installationId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_installationInternalId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['installationInternalId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_providerRepositoryId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['providerRepositoryId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_repositoryId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['repositoryId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_repositoryInternalId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['repositoryInternalId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_framework'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['framework'], + 'lengths' => [64], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_deploymentId'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['deploymentId'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ] + ], + ], 'deployments' => [ '$collection' => ID::custom(Database::METADATA), '$id' => ID::custom('deployments'), @@ -835,28 +1324,6 @@ return [ 'array' => false, 'filters' => [], ], - [ - '$id' => ID::custom('buildInternalId'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => Database::LENGTH_KEY, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('buildId'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => Database::LENGTH_KEY, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], [ 'array' => false, '$id' => ID::custom('entrypoint'), @@ -870,20 +1337,31 @@ return [ ], [ 'array' => false, - '$id' => ID::custom('commands'), + '$id' => ID::custom('buildCommands'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 2048, + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => null, 'filters' => [], ], [ - '$id' => ID::custom('path'), + 'array' => false, + '$id' => ID::custom('buildOutput'), 'type' => Database::VAR_STRING, 'format' => '', - 'size' => 2048, + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'filters' => [], + ], + [ + '$id' => ID::custom('sourcePath'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, 'signed' => true, 'required' => false, 'default' => null, @@ -1073,18 +1551,18 @@ return [ 'array' => false, ], [ - '$id' => ID::custom('size'), + '$id' => ID::custom('sourceSize'), 'type' => Database::VAR_INTEGER, 'format' => '', - 'size' => 0, - 'signed' => true, + 'size' => 8, + 'signed' => false, 'required' => false, 'default' => null, 'array' => false, 'filters' => [], ], [ - '$id' => ID::custom('metadata'), + '$id' => ID::custom('sourceMetadata'), 'type' => Database::VAR_STRING, 'format' => '', 'size' => 16384, // https://tools.ietf.org/html/rfc4288#section-4.2 @@ -1095,7 +1573,7 @@ return [ 'filters' => ['json'], ], [ - '$id' => ID::custom('chunksTotal'), + '$id' => ID::custom('sourceChunksTotal'), 'type' => Database::VAR_INTEGER, 'format' => '', 'size' => 0, @@ -1106,7 +1584,7 @@ return [ 'filters' => [], ], [ - '$id' => ID::custom('chunksUploaded'), + '$id' => ID::custom('sourceChunksUploaded'), 'type' => Database::VAR_INTEGER, 'format' => '', 'size' => 0, @@ -1116,17 +1594,6 @@ return [ 'array' => false, 'filters' => [], ], - [ - '$id' => ID::custom('search'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 16384, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], [ '$id' => ID::custom('activate'), 'type' => Database::VAR_BOOLEAN, @@ -1137,6 +1604,138 @@ return [ 'default' => false, 'array' => false, 'filters' => [], + ], + [ + '$id' => ID::custom('screenshotLight'), // File ID from 'screenshots' Console bucket + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 32, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('screenshotDark'), // File ID from 'screenshots' Console bucket + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 32, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('buildStartedAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('buildEndedAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('buildDuration'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('buildSize'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 8, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('totalSize'), + 'type' => Database::VAR_INTEGER, + 'format' => '', + 'size' => 8, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('status'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16, + 'signed' => true, + 'required' => false, + 'default' => 'waiting', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('buildPath'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('buildLogs'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 1000000, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('adapter'), // ssr or static; named this way as it's a term in SSR frameworks + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16, + 'signed' => true, + 'required' => false, + 'default' => '', + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('fallbackFile'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 16384, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], ] ], 'indexes' => [ @@ -1155,23 +1754,30 @@ return [ 'orders' => [Database::ORDER_ASC], ], [ - '$id' => ID::custom('_key_search'), - 'type' => Database::INDEX_FULLTEXT, - 'attributes' => ['search'], - 'lengths' => [], - 'orders' => [], - ], - [ - '$id' => ID::custom('_key_size'), + '$id' => ID::custom('_key_sourceSize'), 'type' => Database::INDEX_KEY, - 'attributes' => ['size'], + 'attributes' => ['sourceSize'], 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], [ - '$id' => ID::custom('_key_buildId'), + '$id' => ID::custom('_key_buildSize'), 'type' => Database::INDEX_KEY, - 'attributes' => ['buildId'], + 'attributes' => ['buildSize'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_totalSize'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['totalSize'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_buildDuration'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['buildDuration'], 'lengths' => [], 'orders' => [Database::ORDER_ASC], ], @@ -1183,165 +1789,30 @@ return [ 'orders' => [Database::ORDER_ASC], ], [ - '$id' => ID::custom('_key_resource_internal_id'), + '$id' => ID::custom('_key_type'), 'type' => Database::INDEX_KEY, - 'attributes' => ['resourceInternalId'], - 'lengths' => [], - 'orders' => [], - ], - ], - ], - - 'builds' => [ - '$collection' => ID::custom(Database::METADATA), - '$id' => ID::custom('builds'), - 'name' => 'Builds', - 'attributes' => [ - [ - '$id' => ID::custom('startTime'), - 'type' => Database::VAR_DATETIME, - 'format' => '', - 'size' => 0, - 'signed' => false, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => ['datetime'], - ], - [ - '$id' => ID::custom('endTime'), - 'type' => Database::VAR_DATETIME, - 'format' => '', - 'size' => 0, - 'signed' => false, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => ['datetime'], - ], - [ - '$id' => ID::custom('duration'), - 'type' => Database::VAR_INTEGER, - 'format' => '', - 'size' => 0, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('size'), - 'type' => Database::VAR_INTEGER, - 'format' => '', - 'size' => 0, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('deploymentInternalId'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => Database::LENGTH_KEY, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('deploymentId'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => Database::LENGTH_KEY, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('runtime'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 2048, - 'signed' => true, - 'required' => true, - 'default' => '', - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('status'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 256, - 'signed' => true, - 'required' => true, - 'default' => 'processing', - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('path'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 2048, - 'signed' => true, - 'required' => false, - 'default' => '', - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('logs'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 1000000, - 'signed' => true, - 'required' => false, - 'default' => '', - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('sourceType'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 2048, - 'signed' => true, - 'required' => true, - 'default' => 'local', - 'array' => false, - 'filters' => [], - ], - [ - '$id' => ID::custom('source'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 2048, - 'signed' => true, - 'required' => true, - 'default' => '', - 'array' => false, - 'filters' => [], - ] - ], - 'indexes' => [ - [ - '$id' => ID::custom('_key_deployment'), - 'type' => Database::INDEX_KEY, - 'attributes' => ['deploymentId'], - 'lengths' => [Database::LENGTH_KEY], + 'attributes' => ['type'], + 'lengths' => [32], 'orders' => [Database::ORDER_ASC], ], [ - '$id' => ID::custom('_key_deployment_internal_id'), + '$id' => ID::custom('_key_status'), 'type' => Database::INDEX_KEY, - 'attributes' => ['deploymentInternalId'], + 'attributes' => ['status'], + 'lengths' => [16], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => ID::custom('_key_resourceId_resourceType'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['resourceId', 'resourceType'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => ID::custom('_key_resource_internal_id'), + 'type' => Database::INDEX_KEY, + 'attributes' => ['resourceInternalId'], 'lengths' => [], 'orders' => [], ], @@ -1354,7 +1825,7 @@ return [ 'name' => 'Executions', 'attributes' => [ [ - '$id' => ID::custom('functionInternalId'), + '$id' => ID::custom('resourceInternalId'), 'type' => Database::VAR_STRING, 'format' => '', 'size' => Database::LENGTH_KEY, @@ -1365,7 +1836,18 @@ return [ 'filters' => [], ], [ - '$id' => ID::custom('functionId'), + '$id' => ID::custom('resourceId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('resourceType'), 'type' => Database::VAR_STRING, 'format' => '', 'size' => Database::LENGTH_KEY, @@ -1507,17 +1989,6 @@ return [ 'array' => false, 'filters' => ['json'], ], - [ - '$id' => ID::custom('search'), - 'type' => Database::VAR_STRING, - 'format' => '', - 'size' => 16384, - 'signed' => true, - 'required' => false, - 'default' => null, - 'array' => false, - 'filters' => [], - ], [ '$id' => ID::custom('scheduledAt'), 'type' => Database::VAR_DATETIME, @@ -1554,19 +2025,12 @@ return [ ], 'indexes' => [ [ - '$id' => ID::custom('_key_function'), + '$id' => ID::custom('_key_resource'), 'type' => Database::INDEX_KEY, - 'attributes' => ['functionId'], + 'attributes' => ['resourceInternalId', 'resourceType', 'resourceId'], 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], ], - [ - '$id' => ID::custom('_fulltext_search'), - 'type' => Database::INDEX_FULLTEXT, - 'attributes' => ['search'], - 'lengths' => [], - 'orders' => [], - ], [ '$id' => ID::custom('_key_trigger'), 'type' => Database::INDEX_KEY, @@ -1619,7 +2083,7 @@ return [ [ '$id' => ID::custom('_key_function_internal_id'), 'type' => Database::INDEX_KEY, - 'attributes' => ['functionInternalId'], + 'attributes' => ['resourceInternalId'], 'lengths' => [], 'orders' => [], ], @@ -1686,6 +2150,17 @@ return [ 'array' => false, 'filters' => ['encrypt'] ], + [ + '$id' => ID::custom('secret'), + 'type' => Database::VAR_BOOLEAN, + 'format' => '', + 'size' => 0, + 'signed' => true, + 'required' => false, + 'default' => false, + 'array' => false, + 'filters' => [], + ], [ '$id' => ID::custom('search'), 'type' => Database::VAR_STRING, @@ -1811,6 +2286,17 @@ return [ 'array' => false, 'filters' => ['json', 'encrypt'], ], + [ + '$id' => ID::custom('options'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 65536, + 'signed' => true, + 'required' => false, + 'default' => [], + 'array' => false, + 'filters' => ['json'], + ], [ '$id' => ID::custom('resources'), 'type' => Database::VAR_STRING, @@ -1865,7 +2351,29 @@ return [ 'default' => null, 'array' => false, 'filters' => [], - ] + ], + [ + '$id' => ID::custom('resourceId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('resourceType'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => [], + ], ], 'indexes' => [ [ @@ -1889,6 +2397,13 @@ return [ 'lengths' => [Database::LENGTH_KEY], 'orders' => [Database::ORDER_ASC], ], + [ + '$id' => '_key_resource_id', + 'type' => Database::INDEX_KEY, + 'attributes' => ['resourceId'], + 'lengths' => [Database::LENGTH_KEY], + 'orders' => [Database::ORDER_DESC], + ], [ '$id' => ID::custom('_fulltext_search'), 'type' => Database::INDEX_FULLTEXT, @@ -1898,4 +2413,101 @@ return [ ] ], ], + + 'resourceTokens' => [ + '$collection' => ID::custom(Database::METADATA), + '$id' => ID::custom('resourceTokens'), + 'name' => 'Resource Tokens', + 'attributes' => [ + [ + '$id' => ID::custom('resourceId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('resourceInternalId'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => Database::LENGTH_KEY, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('resourceType'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 100, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => [], + ], + [ + '$id' => ID::custom('secret'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 512, + 'signed' => true, + 'required' => true, + 'default' => null, + 'array' => false, + 'filters' => ['encrypt'], + ], + [ + '$id' => ID::custom('expire'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 255, + 'signed' => true, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + [ + '$id' => ID::custom('accessedAt'), + 'type' => Database::VAR_DATETIME, + 'format' => '', + 'size' => 0, + 'signed' => false, + 'required' => false, + 'default' => null, + 'array' => false, + 'filters' => ['datetime'], + ], + ], + 'indexes' => [ + [ + '$id' => '_key_expiry_date', + 'type' => Database::INDEX_KEY, + 'attributes' => ['expire'], + 'lengths' => [], + 'orders' => [Database::ORDER_ASC], + ], + [ + '$id' => '_key_accessedAt', + 'type' => Database::INDEX_KEY, + 'attributes' => ['accessedAt'], + 'lengths' => [], + 'orders' => [], + ], + [ + '$id' => '_key_resourceInternalId_resourceType', + 'type' => Database::INDEX_KEY, + 'attributes' => ['resourceInternalId', 'resourceType'], + 'lengths' => [], + 'orders' => [], + ], + ], + ], ]; diff --git a/app/config/errors.php b/app/config/errors.php index eb5a6cbbbb..6d9d29a8ea 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -375,6 +375,13 @@ return [ 'code' => 409, ], + /** Console */ + Exception::RESOURCE_ALREADY_EXISTS => [ + 'name' => Exception::RESOURCE_ALREADY_EXISTS, + 'description' => 'Resource with the requested ID already exists. Please choose a different ID and try again.', + 'code' => 409, + ], + /** Membership */ Exception::MEMBERSHIP_NOT_FOUND => [ 'name' => Exception::MEMBERSHIP_NOT_FOUND, @@ -481,6 +488,23 @@ return [ 'code' => 403, ], + /** Tokens */ + Exception::TOKEN_NOT_FOUND => [ + 'name' => Exception::TOKEN_NOT_FOUND, + 'description' => 'The requested file token could not be found.', + 'code' => 404, + ], + Exception::TOKEN_EXPIRED => [ + 'name' => Exception::TOKEN_EXPIRED, + 'description' => 'The requested file token has expired.', + 'code' => 401, + ], + Exception::TOKEN_RESOURCE_TYPE_INVALID => [ + 'name' => Exception::TOKEN_RESOURCE_TYPE_INVALID, + 'description' => 'The resource type for the token is invalid.', + 'code' => 400, + ], + /** VCS */ Exception::INSTALLATION_NOT_FOUND => [ 'name' => Exception::INSTALLATION_NOT_FOUND, @@ -520,7 +544,7 @@ return [ 'code' => 404, ], Exception::FUNCTION_ENTRYPOINT_MISSING => [ - 'name' => Exception::FUNCTION_RUNTIME_UNSUPPORTED, + 'name' => Exception::FUNCTION_ENTRYPOINT_MISSING, 'description' => 'Entrypoint for your Appwrite Function is missing. Please specify it when making deployment or update the entrypoint under your function\'s "Settings" > "Configuration" > "Entrypoint".', 'code' => 404, ], @@ -534,6 +558,28 @@ return [ 'description' => 'Function Template with the requested ID could not be found.', 'code' => 404, ], + Exception::FUNCTION_RUNTIME_NOT_DETECTED => [ + 'name' => Exception::FUNCTION_RUNTIME_NOT_DETECTED, + 'description' => 'Function runtime could not be detected.', + 'code' => 400, + ], + Exception::FUNCTION_EXECUTE_PERMISSION_MISSING => [ + 'name' => Exception::FUNCTION_EXECUTE_PERMISSION_MISSING, + 'description' => 'To execute function using domain, execute permissions must include "any" or "guests".', + 'code' => 401, + ], + + /** Sites */ + Exception::SITE_NOT_FOUND => [ + 'name' => Exception::SITE_NOT_FOUND, + 'description' => 'Site with the requested ID could not be found.', + 'code' => 404, + ], + Exception::SITE_TEMPLATE_NOT_FOUND => [ + 'name' => Exception::SITE_TEMPLATE_NOT_FOUND, + 'description' => 'Site Template with the requested ID could not be found.', + 'code' => 404, + ], /** Builds */ Exception::BUILD_NOT_FOUND => [ @@ -556,6 +602,16 @@ return [ 'description' => 'Build with the requested ID is already completed and cannot be canceled.', 'code' => 400, ], + Exception::BUILD_CANCELED => [ + 'name' => Exception::BUILD_CANCELED, + 'description' => 'Build with the requested ID has been canceled.', + 'code' => 400, + ], + Exception::BUILD_FAILED => [ + 'name' => Exception::BUILD_FAILED, + 'description' => 'Build with the requested ID failed. Please check the logs for more information.', + 'code' => 400, + ], /** Deployments */ Exception::DEPLOYMENT_NOT_FOUND => [ @@ -577,6 +633,13 @@ return [ 'code' => 400, ], + /** Logs */ + Exception::LOG_NOT_FOUND => [ + 'name' => Exception::LOG_NOT_FOUND, + 'description' => 'Log with the requested ID could not be found.', + 'code' => 404, + ], + /** Databases */ Exception::DATABASE_NOT_FOUND => [ 'name' => Exception::DATABASE_NOT_FOUND, @@ -806,7 +869,7 @@ return [ Exception::RULE_VERIFICATION_FAILED => [ 'name' => Exception::RULE_VERIFICATION_FAILED, 'description' => 'Domain verification failed. Please check if your DNS records are correct and try again.', - 'code' => 401, + 'code' => 400, 'publish' => true ], Exception::PROJECT_SMTP_CONFIG_INVALID => [ @@ -849,6 +912,11 @@ return [ 'description' => 'Variable with the same ID already exists in this project. Try again with a different ID.', 'code' => 409, ], + Exception::VARIABLE_CANNOT_UNSET_SECRET => [ + 'name' => Exception::VARIABLE_CANNOT_UNSET_SECRET, + 'description' => 'Secret variables cannot be marked as non-secret. Please re-create the variable if this is your intention.', + 'code' => 400, + ], Exception::GRAPHQL_NO_QUERY => [ 'name' => Exception::GRAPHQL_NO_QUERY, 'description' => 'Param "query" is not optional.', diff --git a/app/config/events.php b/app/config/events.php index 5378502faf..0bfddf4f1f 100644 --- a/app/config/events.php +++ b/app/config/events.php @@ -217,6 +217,34 @@ return [ ], ] ], + 'sites' => [ + '$model' => Response::MODEL_SITE, + '$resource' => true, + '$description' => 'This event triggers on any sites event.', + 'deployments' => [ + '$model' => Response::MODEL_DEPLOYMENT, + '$resource' => true, + '$description' => 'This event triggers on any deployments event.', + 'create' => [ + '$description' => 'This event triggers when a deployment is created.', + ], + 'delete' => [ + '$description' => 'This event triggers when a deployment is deleted.' + ], + 'update' => [ + '$description' => 'This event triggers when a deployment is updated.' + ], + ], + 'create' => [ + '$description' => 'This event triggers when a site is created.' + ], + 'delete' => [ + '$description' => 'This event triggers when a site is deleted.', + ], + 'update' => [ + '$description' => 'This event triggers when a site is updated.', + ] + ], 'functions' => [ '$model' => Response::MODEL_FUNCTION, '$resource' => true, diff --git a/app/config/frameworks.php b/app/config/frameworks.php new file mode 100644 index 0000000000..f4d8ec7ffa --- /dev/null +++ b/app/config/frameworks.php @@ -0,0 +1,312 @@ + [ + 'key' => 'analog', + 'name' => 'Analog', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'bundleCommand' => 'bash /usr/local/server/helpers/analog/bundle.sh', + 'envCommand' => 'source /usr/local/server/helpers/analog/env.sh', + 'adapters' => [ + 'ssr' => [ + 'key' => 'ssr', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist/analog', + 'startCommand' => 'bash helpers/analog/server.sh', + ], + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist/analog/public', + 'startCommand' => 'bash helpers/server.sh', + 'fallbackFile' => 'index.html' + ] + ] + ], + 'angular' => [ + 'key' => 'angular', + 'name' => 'Angular', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'bundleCommand' => 'bash /usr/local/server/helpers/angular/bundle.sh', + 'envCommand' => 'source /usr/local/server/helpers/angular/env.sh', + 'adapters' => [ + 'ssr' => [ + 'key' => 'ssr', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist/angular', + 'startCommand' => 'bash helpers/angular/server.sh', + ], + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist/angular/browser', + 'startCommand' => 'bash helpers/server.sh', + 'fallbackFile' => 'index.csr.html' + ] + ] + ], + 'nextjs' => [ + 'key' => 'nextjs', + 'name' => 'Next.js', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'bundleCommand' => 'bash /usr/local/server/helpers/next-js/bundle.sh', + 'envCommand' => 'source /usr/local/server/helpers/next-js/env.sh', + 'adapters' => [ + 'ssr' => [ + 'key' => 'ssr', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './.next', + 'startCommand' => 'bash helpers/next-js/server.sh', + ], + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './out', + 'startCommand' => 'bash helpers/server.sh', + ] + ] + ], + 'react' => [ + 'key' => 'react', + 'name' => 'React', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'adapters' => [ + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist', + 'startCommand' => 'bash helpers/server.sh', + 'fallbackFile' => 'index.html' + ] + ] + ], + 'nuxt' => [ + 'key' => 'nuxt', + 'name' => 'Nuxt', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'bundleCommand' => 'bash /usr/local/server/helpers/nuxt/bundle.sh', + 'envCommand' => 'source /usr/local/server/helpers/nuxt/env.sh', + 'adapters' => [ + 'ssr' => [ + 'key' => 'ssr', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './.output', + 'startCommand' => 'bash helpers/nuxt/server.sh', + ], + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run generate', + 'installCommand' => 'npm install', + 'outputDirectory' => './output/public', + 'startCommand' => 'bash helpers/server.sh', + ] + ] + ], + 'vue' => [ + 'key' => 'vue', + 'name' => 'Vue.js', + 'screenshotSleep' => 5000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'adapters' => [ + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist', + 'startCommand' => 'bash helpers/server.sh', + 'fallbackFile' => 'index.html' + ] + ] + ], + 'sveltekit' => [ + 'key' => 'sveltekit', + 'name' => 'SvelteKit', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'bundleCommand' => 'bash /usr/local/server/helpers/sveltekit/bundle.sh', + 'envCommand' => 'source /usr/local/server/helpers/sveltekit/env.sh', + 'adapters' => [ + 'ssr' => [ + 'key' => 'ssr', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './build', + 'startCommand' => 'bash helpers/sveltekit/server.sh', + ], + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './build', + 'startCommand' => 'bash helpers/server.sh', + ] + ] + ], + 'astro' => [ + 'key' => 'astro', + 'name' => 'Astro', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'bundleCommand' => 'bash /usr/local/server/helpers/astro/bundle.sh', + 'envCommand' => 'source /usr/local/server/helpers/astro/env.sh', + 'adapters' => [ + 'ssr' => [ + 'key' => 'ssr', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist', + 'startCommand' => 'bash helpers/astro/server.sh', + ], + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist', + 'startCommand' => 'bash helpers/server.sh', + ] + ] + ], + 'remix' => [ + 'key' => 'remix', + 'name' => 'Remix', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'bundleCommand' => 'bash /usr/local/server/helpers/remix/bundle.sh', + 'envCommand' => 'source /usr/local/server/helpers/remix/env.sh', + 'adapters' => [ + 'ssr' => [ + 'key' => 'ssr', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './build', + 'startCommand' => 'bash helpers/remix/server.sh', + ], + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './build/client', + 'startCommand' => 'bash helpers/server.sh', + ] + ] + ], + 'lynx' => [ + 'key' => 'lynx', + 'name' => 'Lynx', + 'screenshotSleep' => 5000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'adapters' => [ + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist', + 'startCommand' => 'bash helpers/server.sh', + 'fallbackFile' => 'index.html' + ] + ] + ], + 'flutter' => [ + 'key' => 'flutter', + 'name' => 'Flutter', + 'screenshotSleep' => 5000, + 'buildRuntime' => 'flutter-3.29', + 'runtimes' => getVersions($templateRuntimes['FLUTTER']['versions'], 'flutter'), + 'adapters' => [ + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'flutter build web --release -t lib/main.dart', + 'installCommand' => 'flutter pub get', + 'outputDirectory' => './build/web', + 'startCommand' => 'bash helpers/server.sh', + ], + ], + ], + 'react-native' => [ + 'key' => 'react-native', + 'name' => 'React Native', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'adapters' => [ + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist', + 'startCommand' => 'bash helpers/server.sh', + 'fallbackFile' => 'index.html' + ] + ] + ], + 'vite' => [ + 'key' => 'vite', + 'name' => 'Vite', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'adapters' => [ + 'static' => [ + 'key' => 'static', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'outputDirectory' => './dist', + 'startCommand' => 'bash helpers/server.sh', + ], + ] + ], + 'other' => [ + 'key' => 'other', + 'name' => 'Other', + 'screenshotSleep' => 3000, + 'buildRuntime' => 'node-22', + 'runtimes' => getVersions($templateRuntimes['NODE']['versions'], 'node'), + 'adapters' => [ + 'static' => [ + 'key' => 'static', + 'buildCommand' => '', + 'installCommand' => '', + 'outputDirectory' => './', + 'startCommand' => 'bash helpers/server.sh', + ], + ] + ], +]; diff --git a/app/config/locale/templates/email-base-styled.tpl b/app/config/locale/templates/email-base-styled.tpl index 4d6972389e..f6d3e8cd63 100644 --- a/app/config/locale/templates/email-base-styled.tpl +++ b/app/config/locale/templates/email-base-styled.tpl @@ -79,7 +79,7 @@ + + + +
+
+
Page not found
+

The page you’re looking for doesn’t exist.

+ +
+
+ +
+

Powered by

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/app/views/general/error.phtml b/app/views/general/error.phtml index a3715e0156..c6457ce98f 100644 --- a/app/views/general/error.phtml +++ b/app/views/general/error.phtml @@ -1,22 +1,112 @@ getParam('development', false); $type = $this->getParam('type', 'general_server_error'); $code = $this->getParam('code', 500); -$errorID = $this->getParam('errorID', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); $message = $this->getParam('message', ''); $trace = $this->getParam('trace', []); -$projectName = $this->getParam('projectName', ''); -$projectURL = $this->getParam('projectURL', ''); -$title = $this->getParam('title', '') +$title = $this->getParam('title', 'Error'); +$exception = $this->getParam('exception', null); + +$isSimpleMessage = true; +$label = ''; +$labelClass = ''; +$buttons = []; + +$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; +$hostname = System::getEnv('_APP_DOMAIN'); +// TODO: remove this later +if (System::getEnv('_APP_ENV') === 'development') { + $hostname = 'localhost'; +} + +$url = $protocol . '://' . $hostname; + +if($exception !== null && method_exists($exception, 'getCTAs')) { + foreach ($exception->getCTAs() as $index => $cta) { + $class = ($index === 0) ? 'bordered-button' : 'button'; + + $buttons[] = [ + 'text' => $cta['label'], + 'url' => $cta['url'], + 'class' => $class + ]; + } +} + +switch ($type) { + case 'proxy_error_override': + $type = ''; + $label = 'Error ' . $code; + + $message = $code >= 500 ? 'An unexpected server error occured.' : 'An unexpected client error occured.'; + switch($code) { + case 401: + $message = 'You must sign in to access this page.'; + break; + case 403: + $message = 'You are not authorized to access this page.'; + break; + case 404: + $message = 'The page you are looking for does not exist.'; + break; + case 504: + $message = 'The server did not respond in time.'; + break; + case 501: + $message = 'This page is not implemented yet.'; + break; + } + + break; + case 'function_execute_permission_missing': + $label = 'Execution not permitted'; + $labelClass = 'warning'; + break; + case 'build_not_ready': + $label = 'Deployment is still building'; + $message = 'The page will update after the build completes.'; + $labelClass = 'warning'; + break; + case 'build_failed': + $label = 'Deployment build failed'; + $message = 'An error occurred during the build process.'; + $labelClass = 'error'; + break; + case 'rule_not_found': + $label = 'Nothing is here yet'; + $message = 'This page is empty, but you can make it yours.'; + break; + case 'deployment_not_found': + $label = 'No active deployments'; + $message = 'This page is empty, activate a deployment to make it live.'; + break; + case 'build_canceled': + $label = 'Deployment build canceled'; + $message = 'This build was canceled and won\'t be deployed.'; + break; + case 'general_route_not_found': + $label = 'Page not found'; + $message = 'The page you\'re looking for doesn\'t exist.'; + break; + default: + $label = 'Error ' . $code; + $message = $message; + $isSimpleMessage = false; + break; +} ?> - - - + + + + + getParam('title', '') as="font" type="font/woff2" crossorigin /> - - - - - - - - - - <?php echo $this->print($title); ?> - -
-
-
-

Error print($code); ?>

-

print($message); ?>

-
-

Type

-

print($type); ?>

+ +
+
+
print($label); ?>
+

print($message); ?>

+ +
+ print($type); ?>
- -

Error Trace

- -
-
- - - $value) : ?> - - - - - - - -
print($key, self::FILTER_ESCAPE); ?> - - -
print(var_export($value, true), self::FILTER_ESCAPE); ?>
- -
print($value, self::FILTER_ESCAPE); ?>
- -
-
-
-
+ +
+ + + + + + + + +
-
+
+ +
+ +
Error trace
+ $traceItem): ?> +
+ +
file
+
print($traceItem['file']); ?>
+ + + +
line
+
print($traceItem['line']); ?>
+ + + +
function
+
print($traceItem['function']); ?>
+ + + +
args
+
print(\var_export($traceItem['args'], true)); ?>
+ +
+ +
+ + +
+

Powered by

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
- \ No newline at end of file diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index 816f88299b..6f6fac3f77 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -61,10 +61,13 @@ $image = $this->getParam('image', ''); - traefik.http.routers.appwrite_api_https.tls=true volumes: - appwrite-uploads:/storage/uploads:rw + - appwrite-imports:/storage/imports:rw - appwrite-cache:/storage/cache:rw - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw - appwrite-functions:/storage/functions:rw + - appwrite-sites:/storage/sites:rw + - appwrite-builds:/storage/builds:rw depends_on: - mariadb - redis @@ -86,10 +89,12 @@ $image = $this->getParam('image', ''); - _APP_OPTIONS_ABUSE - _APP_OPTIONS_ROUTER_PROTECTION - _APP_OPTIONS_FORCE_HTTPS - - _APP_OPTIONS_FUNCTIONS_FORCE_HTTPS + - _APP_OPTIONS_ROUTER_FORCE_HTTPS - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN - - _APP_DOMAIN_TARGET + - _APP_DOMAIN_TARGET_CNAME + - _APP_DOMAIN_TARGET_AAAA + - _APP_DOMAIN_TARGET_A - _APP_DOMAIN_FUNCTIONS - _APP_REDIS_HOST - _APP_REDIS_PORT @@ -133,12 +138,15 @@ $image = $this->getParam('image', ''); - _APP_STORAGE_WASABI_SECRET - _APP_STORAGE_WASABI_REGION - _APP_STORAGE_WASABI_BUCKET - - _APP_FUNCTIONS_SIZE_LIMIT + - _APP_COMPUTE_SIZE_LIMIT - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_BUILD_TIMEOUT - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY + - _APP_SITES_TIMEOUT + - _APP_COMPUTE_BUILD_TIMEOUT + - _APP_COMPUTE_CPUS + - _APP_COMPUTE_MEMORY - _APP_FUNCTIONS_RUNTIMES + - _APP_SITES_RUNTIMES + - _APP_DOMAIN_SITES - _APP_EXECUTOR_SECRET - _APP_EXECUTOR_HOST - _APP_LOGGING_CONFIG @@ -169,7 +177,7 @@ $image = $this->getParam('image', ''); appwrite-console: <<: *x-logging container_name: appwrite-console - image: /console:5.2.58 + image: /console:6.0.1 restart: unless-stopped networks: - appwrite @@ -300,6 +308,7 @@ $image = $this->getParam('image', ''); - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw - appwrite-functions:/storage/functions:rw + - appwrite-sites:/storage/sites:rw - appwrite-builds:/storage/builds:rw - appwrite-certificates:/storage/certificates:rw environment: @@ -386,7 +395,9 @@ $image = $this->getParam('image', ''); - mariadb volumes: - appwrite-functions:/storage/functions:rw + - appwrite-sites:/storage/sites:rw - appwrite-builds:/storage/builds:rw + - appwrite-uploads:/storage/uploads:rw environment: - _APP_ENV - _APP_WORKER_PER_CORE @@ -407,12 +418,13 @@ $image = $this->getParam('image', ''); - _APP_VCS_GITHUB_PRIVATE_KEY - _APP_VCS_GITHUB_APP_ID - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_BUILD_TIMEOUT - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY - - _APP_FUNCTIONS_SIZE_LIMIT + - _APP_SITES_TIMEOUT + - _APP_COMPUTE_BUILD_TIMEOUT + - _APP_COMPUTE_CPUS + - _APP_COMPUTE_MEMORY + - _APP_COMPUTE_SIZE_LIMIT - _APP_OPTIONS_FORCE_HTTPS - - _APP_OPTIONS_FUNCTIONS_FORCE_HTTPS + - _APP_OPTIONS_ROUTER_FORCE_HTTPS - _APP_DOMAIN - _APP_STORAGE_DEVICE - _APP_STORAGE_S3_ACCESS_KEY @@ -436,6 +448,7 @@ $image = $this->getParam('image', ''); - _APP_STORAGE_WASABI_SECRET - _APP_STORAGE_WASABI_REGION - _APP_STORAGE_WASABI_BUCKET + - _APP_DOMAIN_SITES appwrite-worker-certificates: image: /: @@ -456,7 +469,9 @@ $image = $this->getParam('image', ''); - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN - - _APP_DOMAIN_TARGET + - _APP_DOMAIN_TARGET_CNAME + - _APP_DOMAIN_TARGET_AAAA + - _APP_DOMAIN_TARGET_A - _APP_DOMAIN_FUNCTIONS - _APP_EMAIL_CERTIFICATES - _APP_REDIS_HOST @@ -498,9 +513,10 @@ $image = $this->getParam('image', ''); - _APP_DB_USER - _APP_DB_PASS - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_BUILD_TIMEOUT - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY + - _APP_SITES_TIMEOUT + - _APP_COMPUTE_BUILD_TIMEOUT + - _APP_COMPUTE_CPUS + - _APP_COMPUTE_MEMORY - _APP_EXECUTOR_SECRET - _APP_EXECUTOR_HOST - _APP_USAGE_STATS @@ -601,6 +617,8 @@ $image = $this->getParam('image', ''); restart: unless-stopped networks: - appwrite + volumes: + - appwrite-imports:/storage/imports:rw depends_on: - mariadb environment: @@ -608,7 +626,9 @@ $image = $this->getParam('image', ''); - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN - - _APP_DOMAIN_TARGET + - _APP_DOMAIN_TARGET_CNAME + - _APP_DOMAIN_TARGET_AAAA + - _APP_DOMAIN_TARGET_A - _APP_EMAIL_SECURITY - _APP_REDIS_HOST - _APP_REDIS_PORT @@ -637,7 +657,9 @@ $image = $this->getParam('image', ''); - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN - - _APP_DOMAIN_TARGET + - _APP_DOMAIN_TARGET_CNAME + - _APP_DOMAIN_TARGET_AAAA + - _APP_DOMAIN_TARGET_A - _APP_DOMAIN_FUNCTIONS - _APP_OPENSSL_KEY_V1 - _APP_REDIS_HOST @@ -663,11 +685,9 @@ $image = $this->getParam('image', ''); container_name: appwrite-task-stats-resources entrypoint: stats-resources <<: *x-logging + restart: unless-stopped networks: - appwrite - volumes: - - ./app:/usr/src/code/app - - ./src:/usr/src/code/src depends_on: - redis - mariadb @@ -829,6 +849,14 @@ $image = $this->getParam('image', ''); - appwrite environment: - _APP_ASSISTANT_OPENAI_API_KEY + + appwrite-browser: + image: appwrite/browser:0.2.4 + container_name: appwrite-browser + <<: *x-logging + restart: unless-stopped + networks: + - appwrite openruntimes-executor: container_name: openruntimes-executor @@ -836,7 +864,7 @@ $image = $this->getParam('image', ''); <<: *x-logging restart: unless-stopped stop_signal: SIGINT - image: openruntimes/executor:0.6.11 + image: openruntimes/executor:0.7.14 networks: - appwrite - runtimes @@ -844,18 +872,20 @@ $image = $this->getParam('image', ''); - /var/run/docker.sock:/var/run/docker.sock - appwrite-builds:/storage/builds:rw - appwrite-functions:/storage/functions:rw + - appwrite-sites:/storage/sites:rw # Host mount nessessary to share files between executor and runtimes. # It's not possible to share mount file between 2 containers without host mount (copying is too slow) - /tmp:/tmp:rw environment: - - OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_FUNCTIONS_INACTIVE_THRESHOLD - - OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_FUNCTIONS_MAINTENANCE_INTERVAL - - OPR_EXECUTOR_NETWORK=$_APP_FUNCTIONS_RUNTIMES_NETWORK + - OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD + - OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL + - OPR_EXECUTOR_NETWORK=$_APP_COMPUTE_RUNTIMES_NETWORK - OPR_EXECUTOR_DOCKER_HUB_USERNAME=$_APP_DOCKER_HUB_USERNAME - OPR_EXECUTOR_DOCKER_HUB_PASSWORD=$_APP_DOCKER_HUB_PASSWORD - OPR_EXECUTOR_ENV=$_APP_ENV - - OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES + - OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES,$_APP_SITES_RUNTIMES - OPR_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET + - OPR_EXECUTOR_RUNTIME_VERSIONS=v5 - OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG - OPR_EXECUTOR_STORAGE_DEVICE=$_APP_STORAGE_DEVICE - OPR_EXECUTOR_STORAGE_S3_ACCESS_KEY=$_APP_STORAGE_S3_ACCESS_KEY @@ -934,7 +964,9 @@ volumes: appwrite-redis: appwrite-cache: appwrite-uploads: + appwrite-imports: appwrite-certificates: appwrite-functions: + appwrite-sites: appwrite-builds: appwrite-config: diff --git a/app/worker.php b/app/worker.php index 232e0b3684..0dceb4f937 100644 --- a/app/worker.php +++ b/app/worker.php @@ -38,6 +38,7 @@ use Utopia\Queue\Publisher; use Utopia\Queue\Server; use Utopia\Registry\Registry; use Utopia\System\System; +use Utopia\Telemetry\Adapter\None as NoTelemetry; Authorization::disable(); Runtime::enableCoroutine(SWOOLE_HOOK_ALL); @@ -334,6 +335,16 @@ Server::setResource('pools', function (Registry $register) { return $register->get('pools'); }, ['register']); +Server::setResource('telemetry', fn () => new NoTelemetry()); + +Server::setResource('deviceForSites', function (Document $project) { + return getDevice(APP_STORAGE_SITES . '/app-' . $project->getId()); +}, ['project']); + +Server::setResource('deviceForImports', function (Document $project) { + return getDevice(APP_STORAGE_IMPORTS . '/app-' . $project->getId()); +}, ['project']); + Server::setResource('deviceForFunctions', function (Document $project) { return getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $project->getId()); }, ['project']); @@ -355,6 +366,10 @@ Server::setResource( fn () => fn (Document $project, string $resourceType, ?string $resourceId) => false ); +Server::setResource('plan', function (array $plan = []) { + return []; +}); + Server::setResource('certificates', function () { $email = System::getEnv('_APP_EMAIL_CERTIFICATES', System::getEnv('_APP_SYSTEM_SECURITY_EMAIL_ADDRESS')); if (empty($email)) { @@ -365,7 +380,7 @@ Server::setResource('certificates', function () { }); Server::setResource('logError', function (Registry $register, Document $project) { - return function (Throwable $error, string $namespace, string $action, ?array $extras) use ($register, $project) { + return function (Throwable $error, string $namespace, string $action, ?array $extras = null) use ($register, $project) { $logger = $register->get('logger'); if ($logger) { @@ -387,7 +402,7 @@ Server::setResource('logError', function (Registry $register, Document $project) $log->addExtra('trace', $error->getTraceAsString()); - foreach ($extras as $key => $value) { + foreach (($extras ?? []) as $key => $value) { $log->addExtra($key, $value); } diff --git a/bin/screenshot b/bin/screenshot new file mode 100755 index 0000000000..4d8ceb998f --- /dev/null +++ b/bin/screenshot @@ -0,0 +1,3 @@ +#!/bin/sh + +php /usr/src/code/app/cli.php screenshot $@ \ No newline at end of file diff --git a/composer.json b/composer.json index 8b8bb811af..d9109f40f8 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,8 @@ "test": "vendor/bin/phpunit", "lint": "vendor/bin/pint --test", "format": "vendor/bin/pint", - "bench": "vendor/bin/phpbench run --report=benchmark" + "bench": "vendor/bin/phpbench run --report=benchmark", + "check": "./vendor/bin/phpstan analyse -c phpstan.neon" }, "autoload": { "psr-4": { @@ -43,7 +44,7 @@ "ext-openssl": "*", "ext-zlib": "*", "ext-sockets": "*", - "appwrite/php-runtimes": "0.16.*", + "appwrite/php-runtimes": "0.19.*", "appwrite/php-clamav": "2.0.*", "utopia-php/abuse": "0.52.*", "utopia-php/analytics": "0.10.*", @@ -51,6 +52,7 @@ "utopia-php/cache": "0.13.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", + "utopia-php/detector": "0.1.*", "utopia-php/database": "0.69.*", "utopia-php/domains": "0.5.*", "utopia-php/dsn": "0.2.1", @@ -71,7 +73,7 @@ "utopia-php/swoole": "0.8.*", "utopia-php/system": "0.9.*", "utopia-php/telemetry": "0.1.*", - "utopia-php/vcs": "0.9.*", + "utopia-php/vcs": "0.10.*", "utopia-php/websocket": "0.3.*", "matomo/device-detector": "6.1.*", "dragonmantank/cron-expression": "3.3.2", @@ -87,6 +89,7 @@ "appwrite/sdk-generator": "0.40.*", "phpunit/phpunit": "9.*", "swoole/ide-helper": "5.1.2", + "phpstan/phpstan": "1.8.*", "textalk/websocket": "1.5.*", "laravel/pint": "1.*", "phpbench/phpbench": "1.*" diff --git a/composer.lock b/composer.lock index e108e45171..a495c50034 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2c14e20244a06f508dd67cda717aefeb", + "content-hash": "735023e2b70ce47fe65985f195b257bd", "packages": [ { "name": "adhocore/jwt", @@ -157,16 +157,16 @@ }, { "name": "appwrite/php-runtimes", - "version": "0.16.5", + "version": "0.19.0", "source": { "type": "git", "url": "https://github.com/appwrite/runtimes.git", - "reference": "1e430646fdf847a7caf3c611dcf3d6d5a28c3fd9" + "reference": "8d21483efc19b9d977e323188989ee67a188464b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/runtimes/zipball/1e430646fdf847a7caf3c611dcf3d6d5a28c3fd9", - "reference": "1e430646fdf847a7caf3c611dcf3d6d5a28c3fd9", + "url": "https://api.github.com/repos/appwrite/runtimes/zipball/8d21483efc19b9d977e323188989ee67a188464b", + "reference": "8d21483efc19b9d977e323188989ee67a188464b", "shasum": "" }, "require": { @@ -206,9 +206,9 @@ ], "support": { "issues": "https://github.com/appwrite/runtimes/issues", - "source": "https://github.com/appwrite/runtimes/tree/0.16.5" + "source": "https://github.com/appwrite/runtimes/tree/0.19.0" }, - "time": "2024-11-25T15:17:06+00:00" + "time": "2025-03-25T22:37:51+00:00" }, { "name": "beberlei/assert", @@ -3499,16 +3499,16 @@ }, { "name": "utopia-php/database", - "version": "0.69.2", + "version": "0.69.5", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "60591ab073bb80bb9843338754b679bb8169e4ed" + "reference": "4abe53609dfc23b2ea82884d12b149df6a8af2f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/60591ab073bb80bb9843338754b679bb8169e4ed", - "reference": "60591ab073bb80bb9843338754b679bb8169e4ed", + "url": "https://api.github.com/repos/utopia-php/database/zipball/4abe53609dfc23b2ea82884d12b149df6a8af2f5", + "reference": "4abe53609dfc23b2ea82884d12b149df6a8af2f5", "shasum": "" }, "require": { @@ -3549,9 +3549,54 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.69.2" + "source": "https://github.com/utopia-php/database/tree/0.69.5" }, - "time": "2025-05-14T07:51:44+00:00" + "time": "2025-05-17T08:01:51+00:00" + }, + { + "name": "utopia-php/detector", + "version": "0.1.4", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/detector.git", + "reference": "895a4147463965b5f9cbc083b764b6476f547879" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/detector/zipball/895a4147463965b5f9cbc083b764b6476f547879", + "reference": "895a4147463965b5f9cbc083b764b6476f547879", + "shasum": "" + }, + "require": { + "php": ">=8.0" + }, + "require-dev": { + "laravel/pint": "1.2.*", + "phpstan/phpstan": "1.8.*", + "phpunit/phpunit": "^9.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\Detector\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A simple library for fast and reliable environment identification.", + "keywords": [ + "detector", + "framework", + "php", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/detector/issues", + "source": "https://github.com/utopia-php/detector/tree/0.1.4" + }, + "time": "2025-04-09T11:50:45+00:00" }, { "name": "utopia-php/domains", @@ -4546,16 +4591,16 @@ }, { "name": "utopia-php/vcs", - "version": "0.9.5", + "version": "0.10.2", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "055956545ca7ab4e8688df5de1df3e2833859793" + "reference": "1f9823ebcb8fd098607de0074f18f48e28985012" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/055956545ca7ab4e8688df5de1df3e2833859793", - "reference": "055956545ca7ab4e8688df5de1df3e2833859793", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/1f9823ebcb8fd098607de0074f18f48e28985012", + "reference": "1f9823ebcb8fd098607de0074f18f48e28985012", "shasum": "" }, "require": { @@ -4573,8 +4618,7 @@ "type": "library", "autoload": { "psr-4": { - "Utopia\\VCS\\": "src/VCS", - "Utopia\\Detector\\": "src/Detector" + "Utopia\\VCS\\": "src/VCS" } }, "notification-url": "https://packagist.org/downloads/", @@ -4590,9 +4634,9 @@ ], "support": { "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/0.9.5" + "source": "https://github.com/utopia-php/vcs/tree/0.10.2" }, - "time": "2025-04-17T04:38:49+00:00" + "time": "2025-04-17T04:35:25+00:00" }, { "name": "utopia-php/websocket", @@ -4770,16 +4814,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.40.16", + "version": "0.40.17", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "f1f506da74033f0cb5a11e3dffcfd1ee8daf237d" + "reference": "7e333c1003bfd4763e4d6f3a0a799fde5e7bc4de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/f1f506da74033f0cb5a11e3dffcfd1ee8daf237d", - "reference": "f1f506da74033f0cb5a11e3dffcfd1ee8daf237d", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/7e333c1003bfd4763e4d6f3a0a799fde5e7bc4de", + "reference": "7e333c1003bfd4763e4d6f3a0a799fde5e7bc4de", "shasum": "" }, "require": { @@ -4815,9 +4859,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.40.16" + "source": "https://github.com/appwrite/sdk-generator/tree/0.40.17" }, - "time": "2025-05-09T12:06:09+00:00" + "time": "2025-05-16T15:10:54+00:00" }, { "name": "doctrine/annotations", @@ -5617,6 +5661,65 @@ ], "time": "2025-03-12T08:01:40+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.8.11", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "46e223dd68a620da18855c23046ddb00940b4014" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/46e223dd68a620da18855c23046ddb00940b4014", + "reference": "46e223dd68a620da18855c23046ddb00940b4014", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/phpstan/issues", + "source": "https://github.com/phpstan/phpstan/tree/1.8.11" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2022-10-24T15:45:13+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.32", diff --git a/docker-compose.yml b/docker-compose.yml index 7ea2fceadc..7b0eca52a1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -72,10 +72,13 @@ services: - traefik.http.routers.appwrite_api_https.tls=true volumes: - appwrite-uploads:/storage/uploads:rw + - appwrite-imports:/storage/imports:rw - appwrite-cache:/storage/cache:rw - appwrite-config:/storage/config:rw - appwrite-certificates:/storage/certificates:rw - appwrite-functions:/storage/functions:rw + - appwrite-sites:/storage/sites:rw + - appwrite-builds:/storage/builds:rw - ./phpunit.xml:/usr/src/code/phpunit.xml - ./tests:/usr/src/code/tests - ./app:/usr/src/code/app @@ -110,10 +113,12 @@ services: - _APP_OPTIONS_ABUSE - _APP_OPTIONS_ROUTER_PROTECTION - _APP_OPTIONS_FORCE_HTTPS - - _APP_OPTIONS_FUNCTIONS_FORCE_HTTPS + - _APP_OPTIONS_ROUTER_FORCE_HTTPS - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN - - _APP_DOMAIN_TARGET + - _APP_DOMAIN_TARGET_CNAME + - _APP_DOMAIN_TARGET_AAAA + - _APP_DOMAIN_TARGET_A - _APP_DOMAIN_FUNCTIONS - _APP_REDIS_HOST - _APP_REDIS_PORT @@ -157,12 +162,15 @@ services: - _APP_STORAGE_WASABI_SECRET - _APP_STORAGE_WASABI_REGION - _APP_STORAGE_WASABI_BUCKET - - _APP_FUNCTIONS_SIZE_LIMIT + - _APP_COMPUTE_SIZE_LIMIT - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_BUILD_TIMEOUT - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY + - _APP_SITES_TIMEOUT + - _APP_COMPUTE_BUILD_TIMEOUT + - _APP_COMPUTE_CPUS + - _APP_COMPUTE_MEMORY - _APP_FUNCTIONS_RUNTIMES + - _APP_SITES_RUNTIMES + - _APP_DOMAIN_SITES - _APP_EXECUTOR_SECRET - _APP_EXECUTOR_HOST - _APP_LOGGING_CONFIG @@ -205,7 +213,7 @@ services: appwrite-console: <<: *x-logging container_name: appwrite-console - image: appwrite/console:5.2.58 + image: appwrite/console:6.0.1 restart: unless-stopped networks: - appwrite @@ -348,6 +356,7 @@ services: - appwrite-uploads:/storage/uploads:rw - appwrite-cache:/storage/cache:rw - appwrite-functions:/storage/functions:rw + - appwrite-sites:/storage/sites:rw - appwrite-builds:/storage/builds:rw - appwrite-certificates:/storage/certificates:rw - ./app:/usr/src/code/app @@ -436,7 +445,9 @@ services: - appwrite volumes: - appwrite-functions:/storage/functions:rw + - appwrite-sites:/storage/sites:rw - appwrite-builds:/storage/builds:rw + - appwrite-uploads:/storage/uploads:rw - ./app:/usr/src/code/app - ./src:/usr/src/code/src depends_on: @@ -462,12 +473,13 @@ services: - _APP_VCS_GITHUB_PRIVATE_KEY - _APP_VCS_GITHUB_APP_ID - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_BUILD_TIMEOUT - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY - - _APP_FUNCTIONS_SIZE_LIMIT + - _APP_SITES_TIMEOUT + - _APP_COMPUTE_BUILD_TIMEOUT + - _APP_COMPUTE_CPUS + - _APP_COMPUTE_MEMORY + - _APP_COMPUTE_SIZE_LIMIT - _APP_OPTIONS_FORCE_HTTPS - - _APP_OPTIONS_FUNCTIONS_FORCE_HTTPS + - _APP_OPTIONS_ROUTER_FORCE_HTTPS - _APP_DOMAIN - _APP_STORAGE_DEVICE - _APP_STORAGE_S3_ACCESS_KEY @@ -492,6 +504,7 @@ services: - _APP_STORAGE_WASABI_REGION - _APP_STORAGE_WASABI_BUCKET - _APP_DATABASE_SHARED_TABLES + - _APP_DOMAIN_SITES extra_hosts: - "host.docker.internal:host-gateway" @@ -515,7 +528,9 @@ services: - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN - - _APP_DOMAIN_TARGET + - _APP_DOMAIN_TARGET_CNAME + - _APP_DOMAIN_TARGET_AAAA + - _APP_DOMAIN_TARGET_A - _APP_DOMAIN_FUNCTIONS - _APP_EMAIL_CERTIFICATES - _APP_REDIS_HOST @@ -560,9 +575,10 @@ services: - _APP_DB_USER - _APP_DB_PASS - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_BUILD_TIMEOUT - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY + - _APP_SITES_TIMEOUT + - _APP_COMPUTE_BUILD_TIMEOUT + - _APP_COMPUTE_CPUS + - _APP_COMPUTE_MEMORY - _APP_EXECUTOR_SECRET - _APP_EXECUTOR_HOST - _APP_USAGE_STATS @@ -670,6 +686,7 @@ services: networks: - appwrite volumes: + - appwrite-imports:/storage/imports:rw - ./app:/usr/src/code/app - ./src:/usr/src/code/src - ./tests:/usr/src/code/tests @@ -680,7 +697,9 @@ services: - _APP_WORKER_PER_CORE - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN - - _APP_DOMAIN_TARGET + - _APP_DOMAIN_TARGET_CNAME + - _APP_DOMAIN_TARGET_AAAA + - _APP_DOMAIN_TARGET_A - _APP_EMAIL_SECURITY - _APP_REDIS_HOST - _APP_REDIS_PORT @@ -712,7 +731,9 @@ services: - _APP_ENV - _APP_WORKER_PER_CORE - _APP_DOMAIN - - _APP_DOMAIN_TARGET + - _APP_DOMAIN_TARGET_CNAME + - _APP_DOMAIN_TARGET_AAAA + - _APP_DOMAIN_TARGET_A - _APP_DOMAIN_FUNCTIONS - _APP_OPENSSL_KEY_V1 - _APP_REDIS_HOST @@ -919,12 +940,18 @@ services: environment: - _APP_ASSISTANT_OPENAI_API_KEY + appwrite-browser: + container_name: appwrite-browser + image: appwrite/browser:0.2.4 + networks: + - appwrite + openruntimes-executor: container_name: openruntimes-executor hostname: exc1 <<: *x-logging stop_signal: SIGINT - image: openruntimes/executor:0.6.11 + image: openruntimes/executor:0.7.14 restart: unless-stopped networks: - appwrite @@ -933,19 +960,21 @@ services: - /var/run/docker.sock:/var/run/docker.sock - appwrite-builds:/storage/builds:rw - appwrite-functions:/storage/functions:rw + - appwrite-sites:/storage/sites:rw # Host mount nessessary to share files between executor and runtimes. # It's not possible to share mount file between 2 containers without host mount (copying is too slow) - /tmp:/tmp:rw environment: - - OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_FUNCTIONS_INACTIVE_THRESHOLD - - OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_FUNCTIONS_MAINTENANCE_INTERVAL - - OPR_EXECUTOR_NETWORK=$_APP_FUNCTIONS_RUNTIMES_NETWORK + - OPR_EXECUTOR_IMAGE_PULL=enabled + - OPR_EXECUTOR_INACTIVE_TRESHOLD=$_APP_COMPUTE_INACTIVE_THRESHOLD + - OPR_EXECUTOR_MAINTENANCE_INTERVAL=$_APP_COMPUTE_MAINTENANCE_INTERVAL + - OPR_EXECUTOR_NETWORK=$_APP_COMPUTE_RUNTIMES_NETWORK - OPR_EXECUTOR_DOCKER_HUB_USERNAME=$_APP_DOCKER_HUB_USERNAME - OPR_EXECUTOR_DOCKER_HUB_PASSWORD=$_APP_DOCKER_HUB_PASSWORD - OPR_EXECUTOR_ENV=$_APP_ENV - - OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES + - OPR_EXECUTOR_RUNTIMES=$_APP_FUNCTIONS_RUNTIMES,$_APP_SITES_RUNTIMES - OPR_EXECUTOR_SECRET=$_APP_EXECUTOR_SECRET - - OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v4 + - OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v5 - OPR_EXECUTOR_LOGGING_CONFIG=$_APP_LOGGING_CONFIG - OPR_EXECUTOR_STORAGE_DEVICE=$_APP_STORAGE_DEVICE - OPR_EXECUTOR_STORAGE_S3_ACCESS_KEY=$_APP_STORAGE_S3_ACCESS_KEY @@ -1101,7 +1130,9 @@ volumes: appwrite-redis: appwrite-cache: appwrite-uploads: + appwrite-imports: appwrite-certificates: appwrite-functions: + appwrite-sites: appwrite-builds: appwrite-config: diff --git a/docs/examples/1.7.x/client-android/java/account/create-anonymous-session.md b/docs/examples/1.7.x/client-android/java/account/create-anonymous-session.md new file mode 100644 index 0000000000..9d805882b8 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-anonymous-session.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createAnonymousSession(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/create-email-password-session.md b/docs/examples/1.7.x/client-android/java/account/create-email-password-session.md new file mode 100644 index 0000000000..428b6fddb6 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-email-password-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createEmailPasswordSession( + "email@example.com", // email + "password", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-email-token.md b/docs/examples/1.7.x/client-android/java/account/create-email-token.md new file mode 100644 index 0000000000..869f4a8991 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-email-token.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createEmailToken( + "", // userId + "email@example.com", // email + false, // phrase (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-j-w-t.md b/docs/examples/1.7.x/client-android/java/account/create-j-w-t.md new file mode 100644 index 0000000000..9e3bd287f3 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-j-w-t.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createJWT(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/client-android/java/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..6253e00d58 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-magic-u-r-l-token.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createMagicURLToken( + "", // userId + "email@example.com", // email + "https://example.com", // url (optional) + false, // phrase (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-mfa-authenticator.md b/docs/examples/1.7.x/client-android/java/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..54781f2dc8 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-mfa-authenticator.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createMfaAuthenticator( + AuthenticatorType.TOTP, // type + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-mfa-challenge.md b/docs/examples/1.7.x/client-android/java/account/create-mfa-challenge.md new file mode 100644 index 0000000000..87a56fe350 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-mfa-challenge.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticationFactor; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createMfaChallenge( + AuthenticationFactor.EMAIL, // factor + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/client-android/java/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..ab50734215 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-mfa-recovery-codes.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/create-o-auth2session.md b/docs/examples/1.7.x/client-android/java/account/create-o-auth2session.md new file mode 100644 index 0000000000..4420859ce3 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-o-auth2session.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.OAuthProvider; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createOAuth2Session( + OAuthProvider.AMAZON, // provider + "https://example.com", // success (optional) + "https://example.com", // failure (optional) + listOf(), // scopes (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-o-auth2token.md b/docs/examples/1.7.x/client-android/java/account/create-o-auth2token.md new file mode 100644 index 0000000000..e5590c8ceb --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-o-auth2token.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.OAuthProvider; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createOAuth2Token( + OAuthProvider.AMAZON, // provider + "https://example.com", // success (optional) + "https://example.com", // failure (optional) + listOf(), // scopes (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-phone-token.md b/docs/examples/1.7.x/client-android/java/account/create-phone-token.md new file mode 100644 index 0000000000..19d90b3475 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-phone-token.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createPhoneToken( + "", // userId + "+12065550100", // phone + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-phone-verification.md b/docs/examples/1.7.x/client-android/java/account/create-phone-verification.md new file mode 100644 index 0000000000..8c16b6c268 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-phone-verification.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createPhoneVerification(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/create-push-target.md b/docs/examples/1.7.x/client-android/java/account/create-push-target.md new file mode 100644 index 0000000000..d434a5c6f6 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-push-target.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createPushTarget( + "", // targetId + "", // identifier + "", // providerId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-recovery.md b/docs/examples/1.7.x/client-android/java/account/create-recovery.md new file mode 100644 index 0000000000..5592c6eb66 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-recovery.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createRecovery( + "email@example.com", // email + "https://example.com", // url + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-session.md b/docs/examples/1.7.x/client-android/java/account/create-session.md new file mode 100644 index 0000000000..0c59a802b1 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createSession( + "", // userId + "", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create-verification.md b/docs/examples/1.7.x/client-android/java/account/create-verification.md new file mode 100644 index 0000000000..e91acc85f9 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create-verification.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.createVerification( + "https://example.com", // url + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/create.md b/docs/examples/1.7.x/client-android/java/account/create.md new file mode 100644 index 0000000000..ad04805ce3 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/create.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.create( + "", // userId + "email@example.com", // email + "", // password + "", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/delete-identity.md b/docs/examples/1.7.x/client-android/java/account/delete-identity.md new file mode 100644 index 0000000000..d556722769 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/delete-identity.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.deleteIdentity( + "", // identityId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/client-android/java/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..4a9693bf8c --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/delete-mfa-authenticator.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.deleteMfaAuthenticator( + AuthenticatorType.TOTP, // type + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/delete-push-target.md b/docs/examples/1.7.x/client-android/java/account/delete-push-target.md new file mode 100644 index 0000000000..00ab902792 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/delete-push-target.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.deletePushTarget( + "", // targetId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/delete-session.md b/docs/examples/1.7.x/client-android/java/account/delete-session.md new file mode 100644 index 0000000000..99d2f8e888 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/delete-session.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.deleteSession( + "", // sessionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/delete-sessions.md b/docs/examples/1.7.x/client-android/java/account/delete-sessions.md new file mode 100644 index 0000000000..e93f3e33ac --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/delete-sessions.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.deleteSessions(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/client-android/java/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..8274bb351a --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/get-mfa-recovery-codes.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.getMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/get-prefs.md b/docs/examples/1.7.x/client-android/java/account/get-prefs.md new file mode 100644 index 0000000000..5bb11a4a95 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/get-prefs.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.getPrefs(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/get-session.md b/docs/examples/1.7.x/client-android/java/account/get-session.md new file mode 100644 index 0000000000..288cd3b3ba --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/get-session.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.getSession( + "", // sessionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/get.md b/docs/examples/1.7.x/client-android/java/account/get.md new file mode 100644 index 0000000000..6b5eb3b7fa --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/get.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.get(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/list-identities.md b/docs/examples/1.7.x/client-android/java/account/list-identities.md new file mode 100644 index 0000000000..d4a6f9f31d --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/list-identities.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.listIdentities( + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/list-logs.md b/docs/examples/1.7.x/client-android/java/account/list-logs.md new file mode 100644 index 0000000000..951a479f98 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/list-logs.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.listLogs( + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/list-mfa-factors.md b/docs/examples/1.7.x/client-android/java/account/list-mfa-factors.md new file mode 100644 index 0000000000..9ea8331620 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/list-mfa-factors.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.listMfaFactors(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/list-sessions.md b/docs/examples/1.7.x/client-android/java/account/list-sessions.md new file mode 100644 index 0000000000..8946d96e7c --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/list-sessions.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.listSessions(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/update-email.md b/docs/examples/1.7.x/client-android/java/account/update-email.md new file mode 100644 index 0000000000..ac80e451d0 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-email.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateEmail( + "email@example.com", // email + "password", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-m-f-a.md b/docs/examples/1.7.x/client-android/java/account/update-m-f-a.md new file mode 100644 index 0000000000..b765cda94a --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-m-f-a.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateMFA( + false, // mfa + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/client-android/java/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..5893aa6e6b --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-magic-u-r-l-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateMagicURLSession( + "", // userId + "", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-mfa-authenticator.md b/docs/examples/1.7.x/client-android/java/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..b8016e75f2 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-mfa-authenticator.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateMfaAuthenticator( + AuthenticatorType.TOTP, // type + "", // otp + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-mfa-challenge.md b/docs/examples/1.7.x/client-android/java/account/update-mfa-challenge.md new file mode 100644 index 0000000000..c6401504d8 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-mfa-challenge.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateMfaChallenge( + "", // challengeId + "", // otp + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/client-android/java/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..650ae24128 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-mfa-recovery-codes.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/update-name.md b/docs/examples/1.7.x/client-android/java/account/update-name.md new file mode 100644 index 0000000000..47582c2b30 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-name.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateName( + "", // name + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-password.md b/docs/examples/1.7.x/client-android/java/account/update-password.md new file mode 100644 index 0000000000..09f572eb31 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-password.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updatePassword( + "", // password + "password", // oldPassword (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-phone-session.md b/docs/examples/1.7.x/client-android/java/account/update-phone-session.md new file mode 100644 index 0000000000..2e1b880017 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-phone-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updatePhoneSession( + "", // userId + "", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-phone-verification.md b/docs/examples/1.7.x/client-android/java/account/update-phone-verification.md new file mode 100644 index 0000000000..f93ae6906f --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-phone-verification.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updatePhoneVerification( + "", // userId + "", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-phone.md b/docs/examples/1.7.x/client-android/java/account/update-phone.md new file mode 100644 index 0000000000..fae9bfaaec --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-phone.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updatePhone( + "+12065550100", // phone + "password", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-prefs.md b/docs/examples/1.7.x/client-android/java/account/update-prefs.md new file mode 100644 index 0000000000..f1a16c7de0 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-prefs.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updatePrefs( + mapOf( "a" to "b" ), // prefs + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-push-target.md b/docs/examples/1.7.x/client-android/java/account/update-push-target.md new file mode 100644 index 0000000000..197a9095a7 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-push-target.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updatePushTarget( + "", // targetId + "", // identifier + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-recovery.md b/docs/examples/1.7.x/client-android/java/account/update-recovery.md new file mode 100644 index 0000000000..953bde4f26 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-recovery.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateRecovery( + "", // userId + "", // secret + "", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-session.md b/docs/examples/1.7.x/client-android/java/account/update-session.md new file mode 100644 index 0000000000..ed82840836 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-session.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateSession( + "", // sessionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/account/update-status.md b/docs/examples/1.7.x/client-android/java/account/update-status.md new file mode 100644 index 0000000000..9a283c092c --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-status.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateStatus(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/account/update-verification.md b/docs/examples/1.7.x/client-android/java/account/update-verification.md new file mode 100644 index 0000000000..caa3869e25 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/account/update-verification.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Account account = new Account(client); + +account.updateVerification( + "", // userId + "", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/avatars/get-browser.md b/docs/examples/1.7.x/client-android/java/avatars/get-browser.md new file mode 100644 index 0000000000..1b6632f30a --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/avatars/get-browser.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; +import io.appwrite.enums.Browser; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Avatars avatars = new Avatars(client); + +avatars.getBrowser( + Browser.AVANT_BROWSER, // code + 0, // width (optional) + 0, // height (optional) + -1, // quality (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/avatars/get-credit-card.md b/docs/examples/1.7.x/client-android/java/avatars/get-credit-card.md new file mode 100644 index 0000000000..e2ac2c26cd --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/avatars/get-credit-card.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; +import io.appwrite.enums.CreditCard; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Avatars avatars = new Avatars(client); + +avatars.getCreditCard( + CreditCard.AMERICAN_EXPRESS, // code + 0, // width (optional) + 0, // height (optional) + -1, // quality (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/avatars/get-favicon.md b/docs/examples/1.7.x/client-android/java/avatars/get-favicon.md new file mode 100644 index 0000000000..70373a607b --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/avatars/get-favicon.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Avatars avatars = new Avatars(client); + +avatars.getFavicon( + "https://example.com", // url + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/avatars/get-flag.md b/docs/examples/1.7.x/client-android/java/avatars/get-flag.md new file mode 100644 index 0000000000..689e27fe35 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/avatars/get-flag.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; +import io.appwrite.enums.Flag; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Avatars avatars = new Avatars(client); + +avatars.getFlag( + Flag.AFGHANISTAN, // code + 0, // width (optional) + 0, // height (optional) + -1, // quality (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/avatars/get-image.md b/docs/examples/1.7.x/client-android/java/avatars/get-image.md new file mode 100644 index 0000000000..71a90dd1c2 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/avatars/get-image.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Avatars avatars = new Avatars(client); + +avatars.getImage( + "https://example.com", // url + 0, // width (optional) + 0, // height (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/avatars/get-initials.md b/docs/examples/1.7.x/client-android/java/avatars/get-initials.md new file mode 100644 index 0000000000..ca16ee7e36 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/avatars/get-initials.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Avatars avatars = new Avatars(client); + +avatars.getInitials( + "", // name (optional) + 0, // width (optional) + 0, // height (optional) + "", // background (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/avatars/get-q-r.md b/docs/examples/1.7.x/client-android/java/avatars/get-q-r.md new file mode 100644 index 0000000000..781acf6741 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/avatars/get-q-r.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Avatars avatars = new Avatars(client); + +avatars.getQR( + "", // text + 1, // size (optional) + 0, // margin (optional) + false, // download (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/databases/create-document.md b/docs/examples/1.7.x/client-android/java/databases/create-document.md new file mode 100644 index 0000000000..7fb129bb0b --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/databases/create-document.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("") // + .setJWT(""); // Your secret JSON Web Token + +Databases databases = new Databases(client); + +databases.createDocument( + "", // databaseId + "", // collectionId + "", // documentId + mapOf( "a" to "b" ), // data + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/databases/delete-document.md b/docs/examples/1.7.x/client-android/java/databases/delete-document.md new file mode 100644 index 0000000000..5288e53bed --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/databases/delete-document.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Databases databases = new Databases(client); + +databases.deleteDocument( + "", // databaseId + "", // collectionId + "", // documentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/databases/get-document.md b/docs/examples/1.7.x/client-android/java/databases/get-document.md new file mode 100644 index 0000000000..e7ae2079ed --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/databases/get-document.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Databases databases = new Databases(client); + +databases.getDocument( + "", // databaseId + "", // collectionId + "", // documentId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/databases/list-documents.md b/docs/examples/1.7.x/client-android/java/databases/list-documents.md new file mode 100644 index 0000000000..606d67705d --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/databases/list-documents.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Databases databases = new Databases(client); + +databases.listDocuments( + "", // databaseId + "", // collectionId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/databases/update-document.md b/docs/examples/1.7.x/client-android/java/databases/update-document.md new file mode 100644 index 0000000000..baa827cdf5 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/databases/update-document.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Databases databases = new Databases(client); + +databases.updateDocument( + "", // databaseId + "", // collectionId + "", // documentId + mapOf( "a" to "b" ), // data (optional) + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/functions/create-execution.md b/docs/examples/1.7.x/client-android/java/functions/create-execution.md new file mode 100644 index 0000000000..c138b0ef86 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/functions/create-execution.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Functions functions = new Functions(client); + +functions.createExecution( + "", // functionId + "", // body (optional) + false, // async (optional) + "", // path (optional) + ExecutionMethod.GET, // method (optional) + mapOf( "a" to "b" ), // headers (optional) + "", // scheduledAt (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/functions/get-execution.md b/docs/examples/1.7.x/client-android/java/functions/get-execution.md new file mode 100644 index 0000000000..f3195fa126 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/functions/get-execution.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Functions functions = new Functions(client); + +functions.getExecution( + "", // functionId + "", // executionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/functions/list-executions.md b/docs/examples/1.7.x/client-android/java/functions/list-executions.md new file mode 100644 index 0000000000..0270cf0ead --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/functions/list-executions.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Functions functions = new Functions(client); + +functions.listExecutions( + "", // functionId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/graphql/mutation.md b/docs/examples/1.7.x/client-android/java/graphql/mutation.md new file mode 100644 index 0000000000..25f095e1b1 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/graphql/mutation.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Graphql; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Graphql graphql = new Graphql(client); + +graphql.mutation( + mapOf( "a" to "b" ), // query + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/graphql/query.md b/docs/examples/1.7.x/client-android/java/graphql/query.md new file mode 100644 index 0000000000..6b2a04d0b6 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/graphql/query.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Graphql; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Graphql graphql = new Graphql(client); + +graphql.query( + mapOf( "a" to "b" ), // query + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/locale/get.md b/docs/examples/1.7.x/client-android/java/locale/get.md new file mode 100644 index 0000000000..89e1e88b26 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/locale/get.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Locale locale = new Locale(client); + +locale.get(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/locale/list-codes.md b/docs/examples/1.7.x/client-android/java/locale/list-codes.md new file mode 100644 index 0000000000..85a96fce77 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/locale/list-codes.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Locale locale = new Locale(client); + +locale.listCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/locale/list-continents.md b/docs/examples/1.7.x/client-android/java/locale/list-continents.md new file mode 100644 index 0000000000..6f4572d572 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/locale/list-continents.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Locale locale = new Locale(client); + +locale.listContinents(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/locale/list-countries-e-u.md b/docs/examples/1.7.x/client-android/java/locale/list-countries-e-u.md new file mode 100644 index 0000000000..51458a929d --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/locale/list-countries-e-u.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Locale locale = new Locale(client); + +locale.listCountriesEU(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/locale/list-countries-phones.md b/docs/examples/1.7.x/client-android/java/locale/list-countries-phones.md new file mode 100644 index 0000000000..93438d2130 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/locale/list-countries-phones.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Locale locale = new Locale(client); + +locale.listCountriesPhones(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/locale/list-countries.md b/docs/examples/1.7.x/client-android/java/locale/list-countries.md new file mode 100644 index 0000000000..5cd5525e93 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/locale/list-countries.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Locale locale = new Locale(client); + +locale.listCountries(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/locale/list-currencies.md b/docs/examples/1.7.x/client-android/java/locale/list-currencies.md new file mode 100644 index 0000000000..d3ef02c865 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/locale/list-currencies.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Locale locale = new Locale(client); + +locale.listCurrencies(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/locale/list-languages.md b/docs/examples/1.7.x/client-android/java/locale/list-languages.md new file mode 100644 index 0000000000..0d724943a9 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/locale/list-languages.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Locale locale = new Locale(client); + +locale.listLanguages(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); +})); diff --git a/docs/examples/1.7.x/client-android/java/messaging/create-subscriber.md b/docs/examples/1.7.x/client-android/java/messaging/create-subscriber.md new file mode 100644 index 0000000000..5616435ab5 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/messaging/create-subscriber.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Messaging messaging = new Messaging(client); + +messaging.createSubscriber( + "", // topicId + "", // subscriberId + "", // targetId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/messaging/delete-subscriber.md b/docs/examples/1.7.x/client-android/java/messaging/delete-subscriber.md new file mode 100644 index 0000000000..9adae5e7df --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/messaging/delete-subscriber.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Messaging messaging = new Messaging(client); + +messaging.deleteSubscriber( + "", // topicId + "", // subscriberId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/storage/create-file.md b/docs/examples/1.7.x/client-android/java/storage/create-file.md new file mode 100644 index 0000000000..598e683150 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/storage/create-file.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.models.InputFile; +import io.appwrite.services.Storage; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Storage storage = new Storage(client); + +storage.createFile( + "", // bucketId + "", // fileId + InputFile.fromPath("file.png"), // file + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/storage/delete-file.md b/docs/examples/1.7.x/client-android/java/storage/delete-file.md new file mode 100644 index 0000000000..5c63ae7cd5 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/storage/delete-file.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Storage storage = new Storage(client); + +storage.deleteFile( + "", // bucketId + "", // fileId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/storage/get-file-download.md b/docs/examples/1.7.x/client-android/java/storage/get-file-download.md new file mode 100644 index 0000000000..73a8617fdd --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/storage/get-file-download.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Storage storage = new Storage(client); + +storage.getFileDownload( + "", // bucketId + "", // fileId + "", // token (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/storage/get-file-preview.md b/docs/examples/1.7.x/client-android/java/storage/get-file-preview.md new file mode 100644 index 0000000000..67b92ebf85 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/storage/get-file-preview.md @@ -0,0 +1,35 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Storage storage = new Storage(client); + +storage.getFilePreview( + "", // bucketId + "", // fileId + 0, // width (optional) + 0, // height (optional) + ImageGravity.CENTER, // gravity (optional) + -1, // quality (optional) + 0, // borderWidth (optional) + "", // borderColor (optional) + 0, // borderRadius (optional) + 0, // opacity (optional) + -360, // rotation (optional) + "", // background (optional) + ImageFormat.JPG, // output (optional) + "", // token (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/storage/get-file-view.md b/docs/examples/1.7.x/client-android/java/storage/get-file-view.md new file mode 100644 index 0000000000..b042b1f451 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/storage/get-file-view.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Storage storage = new Storage(client); + +storage.getFileView( + "", // bucketId + "", // fileId + "", // token (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/storage/get-file.md b/docs/examples/1.7.x/client-android/java/storage/get-file.md new file mode 100644 index 0000000000..c9cc00d8f7 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/storage/get-file.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Storage storage = new Storage(client); + +storage.getFile( + "", // bucketId + "", // fileId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/storage/list-files.md b/docs/examples/1.7.x/client-android/java/storage/list-files.md new file mode 100644 index 0000000000..a87286c6d6 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/storage/list-files.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Storage storage = new Storage(client); + +storage.listFiles( + "", // bucketId + listOf(), // queries (optional) + "", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/storage/update-file.md b/docs/examples/1.7.x/client-android/java/storage/update-file.md new file mode 100644 index 0000000000..14fa77939d --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/storage/update-file.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Storage storage = new Storage(client); + +storage.updateFile( + "", // bucketId + "", // fileId + "", // name (optional) + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/create-membership.md b/docs/examples/1.7.x/client-android/java/teams/create-membership.md new file mode 100644 index 0000000000..bb5293ef63 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/create-membership.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.createMembership( + "", // teamId + listOf(), // roles + "email@example.com", // email (optional) + "", // userId (optional) + "+12065550100", // phone (optional) + "https://example.com", // url (optional) + "", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/create.md b/docs/examples/1.7.x/client-android/java/teams/create.md new file mode 100644 index 0000000000..ae2fdf32c8 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/create.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.create( + "", // teamId + "", // name + listOf(), // roles (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/delete-membership.md b/docs/examples/1.7.x/client-android/java/teams/delete-membership.md new file mode 100644 index 0000000000..c8bb088cc6 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/delete-membership.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.deleteMembership( + "", // teamId + "", // membershipId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/delete.md b/docs/examples/1.7.x/client-android/java/teams/delete.md new file mode 100644 index 0000000000..74f6a4f997 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/delete.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.delete( + "", // teamId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/get-membership.md b/docs/examples/1.7.x/client-android/java/teams/get-membership.md new file mode 100644 index 0000000000..e9dc5786d6 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/get-membership.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.getMembership( + "", // teamId + "", // membershipId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/get-prefs.md b/docs/examples/1.7.x/client-android/java/teams/get-prefs.md new file mode 100644 index 0000000000..8ba14355a1 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/get-prefs.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.getPrefs( + "", // teamId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/get.md b/docs/examples/1.7.x/client-android/java/teams/get.md new file mode 100644 index 0000000000..f00057a822 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/get.md @@ -0,0 +1,22 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.get( + "", // teamId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/list-memberships.md b/docs/examples/1.7.x/client-android/java/teams/list-memberships.md new file mode 100644 index 0000000000..216ca40e6d --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/list-memberships.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.listMemberships( + "", // teamId + listOf(), // queries (optional) + "", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/list.md b/docs/examples/1.7.x/client-android/java/teams/list.md new file mode 100644 index 0000000000..b69f21ed43 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/list.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.list( + listOf(), // queries (optional) + "", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/update-membership-status.md b/docs/examples/1.7.x/client-android/java/teams/update-membership-status.md new file mode 100644 index 0000000000..4b31ed55ec --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/update-membership-status.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.updateMembershipStatus( + "", // teamId + "", // membershipId + "", // userId + "", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/update-membership.md b/docs/examples/1.7.x/client-android/java/teams/update-membership.md new file mode 100644 index 0000000000..481be43107 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/update-membership.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.updateMembership( + "", // teamId + "", // membershipId + listOf(), // roles + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/update-name.md b/docs/examples/1.7.x/client-android/java/teams/update-name.md new file mode 100644 index 0000000000..207bcc81e3 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/update-name.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.updateName( + "", // teamId + "", // name + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/java/teams/update-prefs.md b/docs/examples/1.7.x/client-android/java/teams/update-prefs.md new file mode 100644 index 0000000000..5a0186ff31 --- /dev/null +++ b/docs/examples/1.7.x/client-android/java/teams/update-prefs.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject(""); // Your project ID + +Teams teams = new Teams(client); + +teams.updatePrefs( + "", // teamId + mapOf( "a" to "b" ), // prefs + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + Log.d("Appwrite", result.toString()); + }) +); + diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-anonymous-session.md b/docs/examples/1.7.x/client-android/kotlin/account/create-anonymous-session.md new file mode 100644 index 0000000000..d2966a18cd --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-anonymous-session.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createAnonymousSession() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-email-password-session.md b/docs/examples/1.7.x/client-android/kotlin/account/create-email-password-session.md new file mode 100644 index 0000000000..a327cf280e --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-email-password-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createEmailPasswordSession( + email = "email@example.com", + password = "password", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-email-token.md b/docs/examples/1.7.x/client-android/kotlin/account/create-email-token.md new file mode 100644 index 0000000000..37c9e1b380 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-email-token.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createEmailToken( + userId = "", + email = "email@example.com", + phrase = false, // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-j-w-t.md b/docs/examples/1.7.x/client-android/kotlin/account/create-j-w-t.md new file mode 100644 index 0000000000..c87eaf3128 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-j-w-t.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createJWT() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/client-android/kotlin/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..76f4c91884 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-magic-u-r-l-token.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createMagicURLToken( + userId = "", + email = "email@example.com", + url = "https://example.com", // (optional) + phrase = false, // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-mfa-authenticator.md b/docs/examples/1.7.x/client-android/kotlin/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..ffb2f2f9bf --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-mfa-authenticator.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticatorType + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createMfaAuthenticator( + type = AuthenticatorType.TOTP, +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-mfa-challenge.md b/docs/examples/1.7.x/client-android/kotlin/account/create-mfa-challenge.md new file mode 100644 index 0000000000..36b12d3f98 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-mfa-challenge.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticationFactor + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createMfaChallenge( + factor = AuthenticationFactor.EMAIL, +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/client-android/kotlin/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..974c8f25a0 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createMfaRecoveryCodes() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-o-auth2session.md b/docs/examples/1.7.x/client-android/kotlin/account/create-o-auth2session.md new file mode 100644 index 0000000000..61ea634ad7 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-o-auth2session.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.OAuthProvider + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +account.createOAuth2Session( + provider = OAuthProvider.AMAZON, + success = "https://example.com", // (optional) + failure = "https://example.com", // (optional) + scopes = listOf(), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-o-auth2token.md b/docs/examples/1.7.x/client-android/kotlin/account/create-o-auth2token.md new file mode 100644 index 0000000000..cdd2ef3445 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-o-auth2token.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.OAuthProvider + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +account.createOAuth2Token( + provider = OAuthProvider.AMAZON, + success = "https://example.com", // (optional) + failure = "https://example.com", // (optional) + scopes = listOf(), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-phone-token.md b/docs/examples/1.7.x/client-android/kotlin/account/create-phone-token.md new file mode 100644 index 0000000000..4eb1a9ac4e --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-phone-token.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createPhoneToken( + userId = "", + phone = "+12065550100", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-phone-verification.md b/docs/examples/1.7.x/client-android/kotlin/account/create-phone-verification.md new file mode 100644 index 0000000000..f7594668fa --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-phone-verification.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createPhoneVerification() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-push-target.md b/docs/examples/1.7.x/client-android/kotlin/account/create-push-target.md new file mode 100644 index 0000000000..59b252be15 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-push-target.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createPushTarget( + targetId = "", + identifier = "", + providerId = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-recovery.md b/docs/examples/1.7.x/client-android/kotlin/account/create-recovery.md new file mode 100644 index 0000000000..7e13138111 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-recovery.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createRecovery( + email = "email@example.com", + url = "https://example.com", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-session.md b/docs/examples/1.7.x/client-android/kotlin/account/create-session.md new file mode 100644 index 0000000000..ab9e20e7e2 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createSession( + userId = "", + secret = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create-verification.md b/docs/examples/1.7.x/client-android/kotlin/account/create-verification.md new file mode 100644 index 0000000000..669b00ba18 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create-verification.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.createVerification( + url = "https://example.com", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/create.md b/docs/examples/1.7.x/client-android/kotlin/account/create.md new file mode 100644 index 0000000000..16f3a60ded --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/create.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.create( + userId = "", + email = "email@example.com", + password = "", + name = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/delete-identity.md b/docs/examples/1.7.x/client-android/kotlin/account/delete-identity.md new file mode 100644 index 0000000000..c8d7463685 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/delete-identity.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.deleteIdentity( + identityId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/client-android/kotlin/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..057e021f6d --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/delete-mfa-authenticator.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticatorType + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.deleteMfaAuthenticator( + type = AuthenticatorType.TOTP, +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/delete-push-target.md b/docs/examples/1.7.x/client-android/kotlin/account/delete-push-target.md new file mode 100644 index 0000000000..8e0b418c90 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/delete-push-target.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.deletePushTarget( + targetId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/delete-session.md b/docs/examples/1.7.x/client-android/kotlin/account/delete-session.md new file mode 100644 index 0000000000..6af414be27 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/delete-session.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.deleteSession( + sessionId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/delete-sessions.md b/docs/examples/1.7.x/client-android/kotlin/account/delete-sessions.md new file mode 100644 index 0000000000..f7e6c71c10 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/delete-sessions.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.deleteSessions() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/client-android/kotlin/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..6201658fe3 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/get-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.getMfaRecoveryCodes() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/get-prefs.md b/docs/examples/1.7.x/client-android/kotlin/account/get-prefs.md new file mode 100644 index 0000000000..85dbb18b43 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/get-prefs.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.getPrefs() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/get-session.md b/docs/examples/1.7.x/client-android/kotlin/account/get-session.md new file mode 100644 index 0000000000..4de64a1487 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/get-session.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.getSession( + sessionId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/get.md b/docs/examples/1.7.x/client-android/kotlin/account/get.md new file mode 100644 index 0000000000..3e85e79ad0 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/get.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.get() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/list-identities.md b/docs/examples/1.7.x/client-android/kotlin/account/list-identities.md new file mode 100644 index 0000000000..5908a44a9c --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/list-identities.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.listIdentities( + queries = listOf(), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/list-logs.md b/docs/examples/1.7.x/client-android/kotlin/account/list-logs.md new file mode 100644 index 0000000000..385ccc0116 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/list-logs.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.listLogs( + queries = listOf(), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/list-mfa-factors.md b/docs/examples/1.7.x/client-android/kotlin/account/list-mfa-factors.md new file mode 100644 index 0000000000..09119ab65a --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/list-mfa-factors.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.listMfaFactors() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/list-sessions.md b/docs/examples/1.7.x/client-android/kotlin/account/list-sessions.md new file mode 100644 index 0000000000..573dd865e2 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/list-sessions.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.listSessions() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-email.md b/docs/examples/1.7.x/client-android/kotlin/account/update-email.md new file mode 100644 index 0000000000..0862f112c0 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-email.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateEmail( + email = "email@example.com", + password = "password", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-m-f-a.md b/docs/examples/1.7.x/client-android/kotlin/account/update-m-f-a.md new file mode 100644 index 0000000000..f214e78f44 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-m-f-a.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateMFA( + mfa = false, +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/client-android/kotlin/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..2c1a0b0a38 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-magic-u-r-l-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateMagicURLSession( + userId = "", + secret = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-mfa-authenticator.md b/docs/examples/1.7.x/client-android/kotlin/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..987825e589 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-mfa-authenticator.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticatorType + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateMfaAuthenticator( + type = AuthenticatorType.TOTP, + otp = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-mfa-challenge.md b/docs/examples/1.7.x/client-android/kotlin/account/update-mfa-challenge.md new file mode 100644 index 0000000000..c7f8139f15 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-mfa-challenge.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateMfaChallenge( + challengeId = "", + otp = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/client-android/kotlin/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..c0ee3c386f --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateMfaRecoveryCodes() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-name.md b/docs/examples/1.7.x/client-android/kotlin/account/update-name.md new file mode 100644 index 0000000000..2cb5327ebe --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-name.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateName( + name = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-password.md b/docs/examples/1.7.x/client-android/kotlin/account/update-password.md new file mode 100644 index 0000000000..140ca8b219 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-password.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updatePassword( + password = "", + oldPassword = "password", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-phone-session.md b/docs/examples/1.7.x/client-android/kotlin/account/update-phone-session.md new file mode 100644 index 0000000000..b3911dd5e0 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-phone-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updatePhoneSession( + userId = "", + secret = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-phone-verification.md b/docs/examples/1.7.x/client-android/kotlin/account/update-phone-verification.md new file mode 100644 index 0000000000..ad0d5d73eb --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-phone-verification.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updatePhoneVerification( + userId = "", + secret = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-phone.md b/docs/examples/1.7.x/client-android/kotlin/account/update-phone.md new file mode 100644 index 0000000000..84ff508184 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-phone.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updatePhone( + phone = "+12065550100", + password = "password", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-prefs.md b/docs/examples/1.7.x/client-android/kotlin/account/update-prefs.md new file mode 100644 index 0000000000..fdfed577ac --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-prefs.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updatePrefs( + prefs = mapOf( "a" to "b" ), +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-push-target.md b/docs/examples/1.7.x/client-android/kotlin/account/update-push-target.md new file mode 100644 index 0000000000..5c3816860f --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-push-target.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updatePushTarget( + targetId = "", + identifier = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-recovery.md b/docs/examples/1.7.x/client-android/kotlin/account/update-recovery.md new file mode 100644 index 0000000000..d505d1afb1 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-recovery.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateRecovery( + userId = "", + secret = "", + password = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-session.md b/docs/examples/1.7.x/client-android/kotlin/account/update-session.md new file mode 100644 index 0000000000..6fc9a9f9d2 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-session.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateSession( + sessionId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-status.md b/docs/examples/1.7.x/client-android/kotlin/account/update-status.md new file mode 100644 index 0000000000..b86a25ad4d --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-status.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateStatus() diff --git a/docs/examples/1.7.x/client-android/kotlin/account/update-verification.md b/docs/examples/1.7.x/client-android/kotlin/account/update-verification.md new file mode 100644 index 0000000000..028eb7c4ce --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/account/update-verification.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val account = Account(client) + +val result = account.updateVerification( + userId = "", + secret = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/avatars/get-browser.md b/docs/examples/1.7.x/client-android/kotlin/avatars/get-browser.md new file mode 100644 index 0000000000..d04adfbbdc --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/avatars/get-browser.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars +import io.appwrite.enums.Browser + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val avatars = Avatars(client) + +val result = avatars.getBrowser( + code = Browser.AVANT_BROWSER, + width = 0, // (optional) + height = 0, // (optional) + quality = -1, // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/avatars/get-credit-card.md b/docs/examples/1.7.x/client-android/kotlin/avatars/get-credit-card.md new file mode 100644 index 0000000000..91c88da5dd --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/avatars/get-credit-card.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars +import io.appwrite.enums.CreditCard + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val avatars = Avatars(client) + +val result = avatars.getCreditCard( + code = CreditCard.AMERICAN_EXPRESS, + width = 0, // (optional) + height = 0, // (optional) + quality = -1, // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/avatars/get-favicon.md b/docs/examples/1.7.x/client-android/kotlin/avatars/get-favicon.md new file mode 100644 index 0000000000..01df8cb54b --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/avatars/get-favicon.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val avatars = Avatars(client) + +val result = avatars.getFavicon( + url = "https://example.com", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/avatars/get-flag.md b/docs/examples/1.7.x/client-android/kotlin/avatars/get-flag.md new file mode 100644 index 0000000000..1dbc1cdf4b --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/avatars/get-flag.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars +import io.appwrite.enums.Flag + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val avatars = Avatars(client) + +val result = avatars.getFlag( + code = Flag.AFGHANISTAN, + width = 0, // (optional) + height = 0, // (optional) + quality = -1, // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/avatars/get-image.md b/docs/examples/1.7.x/client-android/kotlin/avatars/get-image.md new file mode 100644 index 0000000000..64166c0a6d --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/avatars/get-image.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val avatars = Avatars(client) + +val result = avatars.getImage( + url = "https://example.com", + width = 0, // (optional) + height = 0, // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/avatars/get-initials.md b/docs/examples/1.7.x/client-android/kotlin/avatars/get-initials.md new file mode 100644 index 0000000000..883da02744 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/avatars/get-initials.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val avatars = Avatars(client) + +val result = avatars.getInitials( + name = "", // (optional) + width = 0, // (optional) + height = 0, // (optional) + background = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/avatars/get-q-r.md b/docs/examples/1.7.x/client-android/kotlin/avatars/get-q-r.md new file mode 100644 index 0000000000..fa8a38cabb --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/avatars/get-q-r.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val avatars = Avatars(client) + +val result = avatars.getQR( + text = "", + size = 1, // (optional) + margin = 0, // (optional) + download = false, // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/databases/create-document.md b/docs/examples/1.7.x/client-android/kotlin/databases/create-document.md new file mode 100644 index 0000000000..0bafb315e7 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/databases/create-document.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("") // + .setJWT("") // Your secret JSON Web Token + +val databases = Databases(client) + +val result = databases.createDocument( + databaseId = "", + collectionId = "", + documentId = "", + data = mapOf( "a" to "b" ), + permissions = listOf("read("any")"), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/databases/delete-document.md b/docs/examples/1.7.x/client-android/kotlin/databases/delete-document.md new file mode 100644 index 0000000000..052bf97f89 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/databases/delete-document.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val databases = Databases(client) + +val result = databases.deleteDocument( + databaseId = "", + collectionId = "", + documentId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/databases/get-document.md b/docs/examples/1.7.x/client-android/kotlin/databases/get-document.md new file mode 100644 index 0000000000..157af2b562 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/databases/get-document.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val databases = Databases(client) + +val result = databases.getDocument( + databaseId = "", + collectionId = "", + documentId = "", + queries = listOf(), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/databases/list-documents.md b/docs/examples/1.7.x/client-android/kotlin/databases/list-documents.md new file mode 100644 index 0000000000..1cc785fab1 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/databases/list-documents.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val databases = Databases(client) + +val result = databases.listDocuments( + databaseId = "", + collectionId = "", + queries = listOf(), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/databases/update-document.md b/docs/examples/1.7.x/client-android/kotlin/databases/update-document.md new file mode 100644 index 0000000000..d61fdea5b1 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/databases/update-document.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val databases = Databases(client) + +val result = databases.updateDocument( + databaseId = "", + collectionId = "", + documentId = "", + data = mapOf( "a" to "b" ), // (optional) + permissions = listOf("read("any")"), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/functions/create-execution.md b/docs/examples/1.7.x/client-android/kotlin/functions/create-execution.md new file mode 100644 index 0000000000..cb7c60bac1 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/functions/create-execution.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val functions = Functions(client) + +val result = functions.createExecution( + functionId = "", + body = "", // (optional) + async = false, // (optional) + path = "", // (optional) + method = ExecutionMethod.GET, // (optional) + headers = mapOf( "a" to "b" ), // (optional) + scheduledAt = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/functions/get-execution.md b/docs/examples/1.7.x/client-android/kotlin/functions/get-execution.md new file mode 100644 index 0000000000..267be53cbb --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/functions/get-execution.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val functions = Functions(client) + +val result = functions.getExecution( + functionId = "", + executionId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/functions/list-executions.md b/docs/examples/1.7.x/client-android/kotlin/functions/list-executions.md new file mode 100644 index 0000000000..37ea8b8228 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/functions/list-executions.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val functions = Functions(client) + +val result = functions.listExecutions( + functionId = "", + queries = listOf(), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/graphql/mutation.md b/docs/examples/1.7.x/client-android/kotlin/graphql/mutation.md new file mode 100644 index 0000000000..a3a762203d --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/graphql/mutation.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Graphql + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val graphql = Graphql(client) + +val result = graphql.mutation( + query = mapOf( "a" to "b" ), +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/graphql/query.md b/docs/examples/1.7.x/client-android/kotlin/graphql/query.md new file mode 100644 index 0000000000..13f149cbf0 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/graphql/query.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Graphql + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val graphql = Graphql(client) + +val result = graphql.query( + query = mapOf( "a" to "b" ), +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/locale/get.md b/docs/examples/1.7.x/client-android/kotlin/locale/get.md new file mode 100644 index 0000000000..a116aed349 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/locale/get.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val locale = Locale(client) + +val result = locale.get() diff --git a/docs/examples/1.7.x/client-android/kotlin/locale/list-codes.md b/docs/examples/1.7.x/client-android/kotlin/locale/list-codes.md new file mode 100644 index 0000000000..0b63b06e3e --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/locale/list-codes.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val locale = Locale(client) + +val result = locale.listCodes() diff --git a/docs/examples/1.7.x/client-android/kotlin/locale/list-continents.md b/docs/examples/1.7.x/client-android/kotlin/locale/list-continents.md new file mode 100644 index 0000000000..98acdc9b6a --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/locale/list-continents.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val locale = Locale(client) + +val result = locale.listContinents() diff --git a/docs/examples/1.7.x/client-android/kotlin/locale/list-countries-e-u.md b/docs/examples/1.7.x/client-android/kotlin/locale/list-countries-e-u.md new file mode 100644 index 0000000000..c01602598b --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/locale/list-countries-e-u.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val locale = Locale(client) + +val result = locale.listCountriesEU() diff --git a/docs/examples/1.7.x/client-android/kotlin/locale/list-countries-phones.md b/docs/examples/1.7.x/client-android/kotlin/locale/list-countries-phones.md new file mode 100644 index 0000000000..d95c1c6ff6 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/locale/list-countries-phones.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val locale = Locale(client) + +val result = locale.listCountriesPhones() diff --git a/docs/examples/1.7.x/client-android/kotlin/locale/list-countries.md b/docs/examples/1.7.x/client-android/kotlin/locale/list-countries.md new file mode 100644 index 0000000000..4775161159 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/locale/list-countries.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val locale = Locale(client) + +val result = locale.listCountries() diff --git a/docs/examples/1.7.x/client-android/kotlin/locale/list-currencies.md b/docs/examples/1.7.x/client-android/kotlin/locale/list-currencies.md new file mode 100644 index 0000000000..6d0a04f808 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/locale/list-currencies.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val locale = Locale(client) + +val result = locale.listCurrencies() diff --git a/docs/examples/1.7.x/client-android/kotlin/locale/list-languages.md b/docs/examples/1.7.x/client-android/kotlin/locale/list-languages.md new file mode 100644 index 0000000000..de588aa077 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/locale/list-languages.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val locale = Locale(client) + +val result = locale.listLanguages() diff --git a/docs/examples/1.7.x/client-android/kotlin/messaging/create-subscriber.md b/docs/examples/1.7.x/client-android/kotlin/messaging/create-subscriber.md new file mode 100644 index 0000000000..b7e244f041 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/messaging/create-subscriber.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val messaging = Messaging(client) + +val result = messaging.createSubscriber( + topicId = "", + subscriberId = "", + targetId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/messaging/delete-subscriber.md b/docs/examples/1.7.x/client-android/kotlin/messaging/delete-subscriber.md new file mode 100644 index 0000000000..9e102d6faa --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/messaging/delete-subscriber.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val messaging = Messaging(client) + +val result = messaging.deleteSubscriber( + topicId = "", + subscriberId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/storage/create-file.md b/docs/examples/1.7.x/client-android/kotlin/storage/create-file.md new file mode 100644 index 0000000000..1c78c51e67 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/storage/create-file.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.models.InputFile +import io.appwrite.services.Storage + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val storage = Storage(client) + +val result = storage.createFile( + bucketId = "", + fileId = "", + file = InputFile.fromPath("file.png"), + permissions = listOf("read("any")"), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/storage/delete-file.md b/docs/examples/1.7.x/client-android/kotlin/storage/delete-file.md new file mode 100644 index 0000000000..ca40f41b71 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/storage/delete-file.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val storage = Storage(client) + +val result = storage.deleteFile( + bucketId = "", + fileId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/storage/get-file-download.md b/docs/examples/1.7.x/client-android/kotlin/storage/get-file-download.md new file mode 100644 index 0000000000..89c6e8a992 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/storage/get-file-download.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val storage = Storage(client) + +val result = storage.getFileDownload( + bucketId = "", + fileId = "", + token = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/storage/get-file-preview.md b/docs/examples/1.7.x/client-android/kotlin/storage/get-file-preview.md new file mode 100644 index 0000000000..d766dc7174 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/storage/get-file-preview.md @@ -0,0 +1,26 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val storage = Storage(client) + +val result = storage.getFilePreview( + bucketId = "", + fileId = "", + width = 0, // (optional) + height = 0, // (optional) + gravity = ImageGravity.CENTER, // (optional) + quality = -1, // (optional) + borderWidth = 0, // (optional) + borderColor = "", // (optional) + borderRadius = 0, // (optional) + opacity = 0, // (optional) + rotation = -360, // (optional) + background = "", // (optional) + output = ImageFormat.JPG, // (optional) + token = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/storage/get-file-view.md b/docs/examples/1.7.x/client-android/kotlin/storage/get-file-view.md new file mode 100644 index 0000000000..513e1f9a90 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/storage/get-file-view.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val storage = Storage(client) + +val result = storage.getFileView( + bucketId = "", + fileId = "", + token = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/storage/get-file.md b/docs/examples/1.7.x/client-android/kotlin/storage/get-file.md new file mode 100644 index 0000000000..1e9943059b --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/storage/get-file.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val storage = Storage(client) + +val result = storage.getFile( + bucketId = "", + fileId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/storage/list-files.md b/docs/examples/1.7.x/client-android/kotlin/storage/list-files.md new file mode 100644 index 0000000000..06f6cda4eb --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/storage/list-files.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val storage = Storage(client) + +val result = storage.listFiles( + bucketId = "", + queries = listOf(), // (optional) + search = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/storage/update-file.md b/docs/examples/1.7.x/client-android/kotlin/storage/update-file.md new file mode 100644 index 0000000000..116d156ead --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/storage/update-file.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val storage = Storage(client) + +val result = storage.updateFile( + bucketId = "", + fileId = "", + name = "", // (optional) + permissions = listOf("read("any")"), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/create-membership.md b/docs/examples/1.7.x/client-android/kotlin/teams/create-membership.md new file mode 100644 index 0000000000..70eb7ddd19 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/create-membership.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.createMembership( + teamId = "", + roles = listOf(), + email = "email@example.com", // (optional) + userId = "", // (optional) + phone = "+12065550100", // (optional) + url = "https://example.com", // (optional) + name = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/create.md b/docs/examples/1.7.x/client-android/kotlin/teams/create.md new file mode 100644 index 0000000000..dfa4df446e --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/create.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.create( + teamId = "", + name = "", + roles = listOf(), // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/delete-membership.md b/docs/examples/1.7.x/client-android/kotlin/teams/delete-membership.md new file mode 100644 index 0000000000..adf1119761 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/delete-membership.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.deleteMembership( + teamId = "", + membershipId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/delete.md b/docs/examples/1.7.x/client-android/kotlin/teams/delete.md new file mode 100644 index 0000000000..e144a78e3d --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/delete.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.delete( + teamId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/get-membership.md b/docs/examples/1.7.x/client-android/kotlin/teams/get-membership.md new file mode 100644 index 0000000000..8fb8c54c3b --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/get-membership.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.getMembership( + teamId = "", + membershipId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/get-prefs.md b/docs/examples/1.7.x/client-android/kotlin/teams/get-prefs.md new file mode 100644 index 0000000000..5e892fb49d --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/get-prefs.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.getPrefs( + teamId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/get.md b/docs/examples/1.7.x/client-android/kotlin/teams/get.md new file mode 100644 index 0000000000..dbb487d3d6 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/get.md @@ -0,0 +1,13 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.get( + teamId = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/list-memberships.md b/docs/examples/1.7.x/client-android/kotlin/teams/list-memberships.md new file mode 100644 index 0000000000..e305403a52 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/list-memberships.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.listMemberships( + teamId = "", + queries = listOf(), // (optional) + search = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/list.md b/docs/examples/1.7.x/client-android/kotlin/teams/list.md new file mode 100644 index 0000000000..984858d26c --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/list.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.list( + queries = listOf(), // (optional) + search = "", // (optional) +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/update-membership-status.md b/docs/examples/1.7.x/client-android/kotlin/teams/update-membership-status.md new file mode 100644 index 0000000000..c3770c7f1e --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/update-membership-status.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.updateMembershipStatus( + teamId = "", + membershipId = "", + userId = "", + secret = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/update-membership.md b/docs/examples/1.7.x/client-android/kotlin/teams/update-membership.md new file mode 100644 index 0000000000..86216a8692 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/update-membership.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.updateMembership( + teamId = "", + membershipId = "", + roles = listOf(), +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/update-name.md b/docs/examples/1.7.x/client-android/kotlin/teams/update-name.md new file mode 100644 index 0000000000..abeb6dc7c1 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/update-name.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.updateName( + teamId = "", + name = "", +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-android/kotlin/teams/update-prefs.md b/docs/examples/1.7.x/client-android/kotlin/teams/update-prefs.md new file mode 100644 index 0000000000..d0066a94b3 --- /dev/null +++ b/docs/examples/1.7.x/client-android/kotlin/teams/update-prefs.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client(context) + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +val teams = Teams(client) + +val result = teams.updatePrefs( + teamId = "", + prefs = mapOf( "a" to "b" ), +) \ No newline at end of file diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/client-apple/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..22020a16d9 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-anonymous-session.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let session = try await account.createAnonymousSession() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-email-password-session.md b/docs/examples/1.7.x/client-apple/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..5f541a8a15 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-email-password-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let session = try await account.createEmailPasswordSession( + email: "email@example.com", + password: "password" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-email-token.md b/docs/examples/1.7.x/client-apple/examples/account/create-email-token.md new file mode 100644 index 0000000000..cf82afde8f --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-email-token.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let token = try await account.createEmailToken( + userId: "", + email: "email@example.com", + phrase: false // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-j-w-t.md b/docs/examples/1.7.x/client-apple/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..fbcd50401c --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-j-w-t.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let jwt = try await account.createJWT() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/client-apple/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..27bbe4137e --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let token = try await account.createMagicURLToken( + userId: "", + email: "email@example.com", + url: "https://example.com", // optional + phrase: false // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/client-apple/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..56799e327e --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-mfa-authenticator.md @@ -0,0 +1,13 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let mfaType = try await account.createMfaAuthenticator( + type: .totp +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/client-apple/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..0b5d385999 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-mfa-challenge.md @@ -0,0 +1,13 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let mfaChallenge = try await account.createMfaChallenge( + factor: .email +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/client-apple/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..c0ccb39e86 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let mfaRecoveryCodes = try await account.createMfaRecoveryCodes() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-o-auth2session.md b/docs/examples/1.7.x/client-apple/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..756112e701 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-o-auth2session.md @@ -0,0 +1,16 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let success = try await account.createOAuth2Session( + provider: .amazon, + success: "https://example.com", // optional + failure: "https://example.com", // optional + scopes: [] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/client-apple/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..21b54e8c9a --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-o-auth2token.md @@ -0,0 +1,16 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let success = try await account.createOAuth2Token( + provider: .amazon, + success: "https://example.com", // optional + failure: "https://example.com", // optional + scopes: [] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-phone-token.md b/docs/examples/1.7.x/client-apple/examples/account/create-phone-token.md new file mode 100644 index 0000000000..12b2d4b223 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-phone-token.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let token = try await account.createPhoneToken( + userId: "", + phone: "+12065550100" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-phone-verification.md b/docs/examples/1.7.x/client-apple/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..f0eb94b6fc --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-phone-verification.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let token = try await account.createPhoneVerification() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-push-target.md b/docs/examples/1.7.x/client-apple/examples/account/create-push-target.md new file mode 100644 index 0000000000..ce2d194272 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-push-target.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let target = try await account.createPushTarget( + targetId: "", + identifier: "", + providerId: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-recovery.md b/docs/examples/1.7.x/client-apple/examples/account/create-recovery.md new file mode 100644 index 0000000000..ccfd5ac519 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-recovery.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let token = try await account.createRecovery( + email: "email@example.com", + url: "https://example.com" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-session.md b/docs/examples/1.7.x/client-apple/examples/account/create-session.md new file mode 100644 index 0000000000..2065692a16 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let session = try await account.createSession( + userId: "", + secret: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create-verification.md b/docs/examples/1.7.x/client-apple/examples/account/create-verification.md new file mode 100644 index 0000000000..d3ca74c7c0 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create-verification.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let token = try await account.createVerification( + url: "https://example.com" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/create.md b/docs/examples/1.7.x/client-apple/examples/account/create.md new file mode 100644 index 0000000000..79b4db64ba --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/create.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.create( + userId: "", + email: "email@example.com", + password: "", + name: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/delete-identity.md b/docs/examples/1.7.x/client-apple/examples/account/delete-identity.md new file mode 100644 index 0000000000..04a3ee5f47 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/delete-identity.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let result = try await account.deleteIdentity( + identityId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/client-apple/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..16cbbe3b72 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,13 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let result = try await account.deleteMfaAuthenticator( + type: .totp +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/delete-push-target.md b/docs/examples/1.7.x/client-apple/examples/account/delete-push-target.md new file mode 100644 index 0000000000..a96a1b1d05 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/delete-push-target.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let result = try await account.deletePushTarget( + targetId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/delete-session.md b/docs/examples/1.7.x/client-apple/examples/account/delete-session.md new file mode 100644 index 0000000000..ea353e8723 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/delete-session.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let result = try await account.deleteSession( + sessionId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/delete-sessions.md b/docs/examples/1.7.x/client-apple/examples/account/delete-sessions.md new file mode 100644 index 0000000000..51a86bdcc3 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/delete-sessions.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let result = try await account.deleteSessions() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/client-apple/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..2f5d623304 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let mfaRecoveryCodes = try await account.getMfaRecoveryCodes() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/get-prefs.md b/docs/examples/1.7.x/client-apple/examples/account/get-prefs.md new file mode 100644 index 0000000000..65ce5f5908 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/get-prefs.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let preferences = try await account.getPrefs() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/get-session.md b/docs/examples/1.7.x/client-apple/examples/account/get-session.md new file mode 100644 index 0000000000..bd491ff4d7 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/get-session.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let session = try await account.getSession( + sessionId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/get.md b/docs/examples/1.7.x/client-apple/examples/account/get.md new file mode 100644 index 0000000000..1b1213e1da --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/get.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.get() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/list-identities.md b/docs/examples/1.7.x/client-apple/examples/account/list-identities.md new file mode 100644 index 0000000000..1d3a999d4a --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/list-identities.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let identityList = try await account.listIdentities( + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/list-logs.md b/docs/examples/1.7.x/client-apple/examples/account/list-logs.md new file mode 100644 index 0000000000..2c42307f96 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/list-logs.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let logList = try await account.listLogs( + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/client-apple/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..f6d7a6fe75 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/list-mfa-factors.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let mfaFactors = try await account.listMfaFactors() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/list-sessions.md b/docs/examples/1.7.x/client-apple/examples/account/list-sessions.md new file mode 100644 index 0000000000..99f6930cd2 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/list-sessions.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let sessionList = try await account.listSessions() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-email.md b/docs/examples/1.7.x/client-apple/examples/account/update-email.md new file mode 100644 index 0000000000..037133282b --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-email.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.updateEmail( + email: "email@example.com", + password: "password" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-m-f-a.md b/docs/examples/1.7.x/client-apple/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..fe2b04f9a3 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-m-f-a.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.updateMFA( + mfa: false +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/client-apple/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..507006b230 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let session = try await account.updateMagicURLSession( + userId: "", + secret: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/client-apple/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..6a42fb9b6d --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-mfa-authenticator.md @@ -0,0 +1,14 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.updateMfaAuthenticator( + type: .totp, + otp: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/client-apple/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..db9753b777 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-mfa-challenge.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let session = try await account.updateMfaChallenge( + challengeId: "", + otp: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/client-apple/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..c3b8d412c5 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let mfaRecoveryCodes = try await account.updateMfaRecoveryCodes() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-name.md b/docs/examples/1.7.x/client-apple/examples/account/update-name.md new file mode 100644 index 0000000000..7f8abf54fb --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-name.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.updateName( + name: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-password.md b/docs/examples/1.7.x/client-apple/examples/account/update-password.md new file mode 100644 index 0000000000..7fa03caebc --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-password.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.updatePassword( + password: "", + oldPassword: "password" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-phone-session.md b/docs/examples/1.7.x/client-apple/examples/account/update-phone-session.md new file mode 100644 index 0000000000..f6776d1de1 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-phone-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let session = try await account.updatePhoneSession( + userId: "", + secret: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-phone-verification.md b/docs/examples/1.7.x/client-apple/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..0bf2db1f0a --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-phone-verification.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let token = try await account.updatePhoneVerification( + userId: "", + secret: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-phone.md b/docs/examples/1.7.x/client-apple/examples/account/update-phone.md new file mode 100644 index 0000000000..604fc85377 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-phone.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.updatePhone( + phone: "+12065550100", + password: "password" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-prefs.md b/docs/examples/1.7.x/client-apple/examples/account/update-prefs.md new file mode 100644 index 0000000000..fea527337b --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-prefs.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.updatePrefs( + prefs: [:] +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-push-target.md b/docs/examples/1.7.x/client-apple/examples/account/update-push-target.md new file mode 100644 index 0000000000..549c4d6c16 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-push-target.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let target = try await account.updatePushTarget( + targetId: "", + identifier: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-recovery.md b/docs/examples/1.7.x/client-apple/examples/account/update-recovery.md new file mode 100644 index 0000000000..536da69b8a --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-recovery.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let token = try await account.updateRecovery( + userId: "", + secret: "", + password: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-session.md b/docs/examples/1.7.x/client-apple/examples/account/update-session.md new file mode 100644 index 0000000000..8999b0a310 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-session.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let session = try await account.updateSession( + sessionId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-status.md b/docs/examples/1.7.x/client-apple/examples/account/update-status.md new file mode 100644 index 0000000000..892858dfbc --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-status.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let user = try await account.updateStatus() + diff --git a/docs/examples/1.7.x/client-apple/examples/account/update-verification.md b/docs/examples/1.7.x/client-apple/examples/account/update-verification.md new file mode 100644 index 0000000000..094e10f33c --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/account/update-verification.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let account = Account(client) + +let token = try await account.updateVerification( + userId: "", + secret: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/avatars/get-browser.md b/docs/examples/1.7.x/client-apple/examples/avatars/get-browser.md new file mode 100644 index 0000000000..ee0cc99f91 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/avatars/get-browser.md @@ -0,0 +1,16 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let avatars = Avatars(client) + +let bytes = try await avatars.getBrowser( + code: .avantBrowser, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/client-apple/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..779fce3f60 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/avatars/get-credit-card.md @@ -0,0 +1,16 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let avatars = Avatars(client) + +let bytes = try await avatars.getCreditCard( + code: .americanExpress, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/avatars/get-favicon.md b/docs/examples/1.7.x/client-apple/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..b7dc6830c3 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/avatars/get-favicon.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let avatars = Avatars(client) + +let bytes = try await avatars.getFavicon( + url: "https://example.com" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/avatars/get-flag.md b/docs/examples/1.7.x/client-apple/examples/avatars/get-flag.md new file mode 100644 index 0000000000..ba1d77be27 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/avatars/get-flag.md @@ -0,0 +1,16 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let avatars = Avatars(client) + +let bytes = try await avatars.getFlag( + code: .afghanistan, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/avatars/get-image.md b/docs/examples/1.7.x/client-apple/examples/avatars/get-image.md new file mode 100644 index 0000000000..0fe71e1765 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/avatars/get-image.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let avatars = Avatars(client) + +let bytes = try await avatars.getImage( + url: "https://example.com", + width: 0, // optional + height: 0 // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/avatars/get-initials.md b/docs/examples/1.7.x/client-apple/examples/avatars/get-initials.md new file mode 100644 index 0000000000..2bbfbe6a47 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/avatars/get-initials.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let avatars = Avatars(client) + +let bytes = try await avatars.getInitials( + name: "", // optional + width: 0, // optional + height: 0, // optional + background: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/avatars/get-q-r.md b/docs/examples/1.7.x/client-apple/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..3cc650c1b9 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/avatars/get-q-r.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let avatars = Avatars(client) + +let bytes = try await avatars.getQR( + text: "", + size: 1, // optional + margin: 0, // optional + download: false // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/databases/create-document.md b/docs/examples/1.7.x/client-apple/examples/databases/create-document.md new file mode 100644 index 0000000000..6c2baee728 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/databases/create-document.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("") // + .setJWT("") // Your secret JSON Web Token + +let databases = Databases(client) + +let document = try await databases.createDocument( + databaseId: "", + collectionId: "", + documentId: "", + data: [:], + permissions: ["read("any")"] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/databases/delete-document.md b/docs/examples/1.7.x/client-apple/examples/databases/delete-document.md new file mode 100644 index 0000000000..301203dc7f --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/databases/delete-document.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let databases = Databases(client) + +let result = try await databases.deleteDocument( + databaseId: "", + collectionId: "", + documentId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/databases/get-document.md b/docs/examples/1.7.x/client-apple/examples/databases/get-document.md new file mode 100644 index 0000000000..6e4dc55c6d --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/databases/get-document.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let databases = Databases(client) + +let document = try await databases.getDocument( + databaseId: "", + collectionId: "", + documentId: "", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/databases/list-documents.md b/docs/examples/1.7.x/client-apple/examples/databases/list-documents.md new file mode 100644 index 0000000000..0d624f3a92 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/databases/list-documents.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let databases = Databases(client) + +let documentList = try await databases.listDocuments( + databaseId: "", + collectionId: "", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/databases/update-document.md b/docs/examples/1.7.x/client-apple/examples/databases/update-document.md new file mode 100644 index 0000000000..af224c8e09 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/databases/update-document.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let databases = Databases(client) + +let document = try await databases.updateDocument( + databaseId: "", + collectionId: "", + documentId: "", + data: [:], // optional + permissions: ["read("any")"] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/functions/create-execution.md b/docs/examples/1.7.x/client-apple/examples/functions/create-execution.md new file mode 100644 index 0000000000..7470e9ebf6 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/functions/create-execution.md @@ -0,0 +1,19 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let functions = Functions(client) + +let execution = try await functions.createExecution( + functionId: "", + body: "", // optional + async: false, // optional + path: "", // optional + method: .gET, // optional + headers: [:], // optional + scheduledAt: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/functions/get-execution.md b/docs/examples/1.7.x/client-apple/examples/functions/get-execution.md new file mode 100644 index 0000000000..787f297b2c --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/functions/get-execution.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let functions = Functions(client) + +let execution = try await functions.getExecution( + functionId: "", + executionId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/functions/list-executions.md b/docs/examples/1.7.x/client-apple/examples/functions/list-executions.md new file mode 100644 index 0000000000..1636d96c6d --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/functions/list-executions.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let functions = Functions(client) + +let executionList = try await functions.listExecutions( + functionId: "", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/graphql/mutation.md b/docs/examples/1.7.x/client-apple/examples/graphql/mutation.md new file mode 100644 index 0000000000..6cd2e588f9 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/graphql/mutation.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let graphql = Graphql(client) + +let any = try await graphql.mutation( + query: [:] +) + diff --git a/docs/examples/1.7.x/client-apple/examples/graphql/query.md b/docs/examples/1.7.x/client-apple/examples/graphql/query.md new file mode 100644 index 0000000000..47e4c243fa --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/graphql/query.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let graphql = Graphql(client) + +let any = try await graphql.query( + query: [:] +) + diff --git a/docs/examples/1.7.x/client-apple/examples/locale/get.md b/docs/examples/1.7.x/client-apple/examples/locale/get.md new file mode 100644 index 0000000000..9c48317a1d --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/locale/get.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let locale = Locale(client) + +let locale = try await locale.get() + diff --git a/docs/examples/1.7.x/client-apple/examples/locale/list-codes.md b/docs/examples/1.7.x/client-apple/examples/locale/list-codes.md new file mode 100644 index 0000000000..21d693a7b8 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/locale/list-codes.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let locale = Locale(client) + +let localeCodeList = try await locale.listCodes() + diff --git a/docs/examples/1.7.x/client-apple/examples/locale/list-continents.md b/docs/examples/1.7.x/client-apple/examples/locale/list-continents.md new file mode 100644 index 0000000000..bd44915a34 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/locale/list-continents.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let locale = Locale(client) + +let continentList = try await locale.listContinents() + diff --git a/docs/examples/1.7.x/client-apple/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/client-apple/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..2dc24e5a63 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/locale/list-countries-e-u.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let locale = Locale(client) + +let countryList = try await locale.listCountriesEU() + diff --git a/docs/examples/1.7.x/client-apple/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/client-apple/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..f3ab6b1f6d --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/locale/list-countries-phones.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let locale = Locale(client) + +let phoneList = try await locale.listCountriesPhones() + diff --git a/docs/examples/1.7.x/client-apple/examples/locale/list-countries.md b/docs/examples/1.7.x/client-apple/examples/locale/list-countries.md new file mode 100644 index 0000000000..dadcd3ee26 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/locale/list-countries.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let locale = Locale(client) + +let countryList = try await locale.listCountries() + diff --git a/docs/examples/1.7.x/client-apple/examples/locale/list-currencies.md b/docs/examples/1.7.x/client-apple/examples/locale/list-currencies.md new file mode 100644 index 0000000000..dc20ead45e --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/locale/list-currencies.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let locale = Locale(client) + +let currencyList = try await locale.listCurrencies() + diff --git a/docs/examples/1.7.x/client-apple/examples/locale/list-languages.md b/docs/examples/1.7.x/client-apple/examples/locale/list-languages.md new file mode 100644 index 0000000000..92c1d7b1dc --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/locale/list-languages.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let locale = Locale(client) + +let languageList = try await locale.listLanguages() + diff --git a/docs/examples/1.7.x/client-apple/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/client-apple/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..f85d5e6fb1 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/messaging/create-subscriber.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let messaging = Messaging(client) + +let subscriber = try await messaging.createSubscriber( + topicId: "", + subscriberId: "", + targetId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/client-apple/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..f1cdda95c7 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/messaging/delete-subscriber.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let messaging = Messaging(client) + +let result = try await messaging.deleteSubscriber( + topicId: "", + subscriberId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/storage/create-file.md b/docs/examples/1.7.x/client-apple/examples/storage/create-file.md new file mode 100644 index 0000000000..2db9b20e1b --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/storage/create-file.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let storage = Storage(client) + +let file = try await storage.createFile( + bucketId: "", + fileId: "", + file: InputFile.fromPath("file.png"), + permissions: ["read("any")"] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/storage/delete-file.md b/docs/examples/1.7.x/client-apple/examples/storage/delete-file.md new file mode 100644 index 0000000000..ca721a4a41 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/storage/delete-file.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let storage = Storage(client) + +let result = try await storage.deleteFile( + bucketId: "", + fileId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/storage/get-file-download.md b/docs/examples/1.7.x/client-apple/examples/storage/get-file-download.md new file mode 100644 index 0000000000..9338958ede --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/storage/get-file-download.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let storage = Storage(client) + +let bytes = try await storage.getFileDownload( + bucketId: "", + fileId: "", + token: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/storage/get-file-preview.md b/docs/examples/1.7.x/client-apple/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..1395d7e782 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/storage/get-file-preview.md @@ -0,0 +1,26 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let storage = Storage(client) + +let bytes = try await storage.getFilePreview( + bucketId: "", + fileId: "", + width: 0, // optional + height: 0, // optional + gravity: .center, // optional + quality: -1, // optional + borderWidth: 0, // optional + borderColor: "", // optional + borderRadius: 0, // optional + opacity: 0, // optional + rotation: -360, // optional + background: "", // optional + output: .jpg, // optional + token: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/storage/get-file-view.md b/docs/examples/1.7.x/client-apple/examples/storage/get-file-view.md new file mode 100644 index 0000000000..bc5ad02727 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/storage/get-file-view.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let storage = Storage(client) + +let bytes = try await storage.getFileView( + bucketId: "", + fileId: "", + token: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/storage/get-file.md b/docs/examples/1.7.x/client-apple/examples/storage/get-file.md new file mode 100644 index 0000000000..2730b4d528 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/storage/get-file.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let storage = Storage(client) + +let file = try await storage.getFile( + bucketId: "", + fileId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/storage/list-files.md b/docs/examples/1.7.x/client-apple/examples/storage/list-files.md new file mode 100644 index 0000000000..48bd0d065f --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/storage/list-files.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let storage = Storage(client) + +let fileList = try await storage.listFiles( + bucketId: "", + queries: [], // optional + search: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/storage/update-file.md b/docs/examples/1.7.x/client-apple/examples/storage/update-file.md new file mode 100644 index 0000000000..adef969845 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/storage/update-file.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let storage = Storage(client) + +let file = try await storage.updateFile( + bucketId: "", + fileId: "", + name: "", // optional + permissions: ["read("any")"] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/create-membership.md b/docs/examples/1.7.x/client-apple/examples/teams/create-membership.md new file mode 100644 index 0000000000..3c6d093c64 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/create-membership.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let membership = try await teams.createMembership( + teamId: "", + roles: [], + email: "email@example.com", // optional + userId: "", // optional + phone: "+12065550100", // optional + url: "https://example.com", // optional + name: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/create.md b/docs/examples/1.7.x/client-apple/examples/teams/create.md new file mode 100644 index 0000000000..b9f5ea4080 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/create.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let team = try await teams.create( + teamId: "", + name: "", + roles: [] // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/delete-membership.md b/docs/examples/1.7.x/client-apple/examples/teams/delete-membership.md new file mode 100644 index 0000000000..7c21410bf3 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/delete-membership.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let result = try await teams.deleteMembership( + teamId: "", + membershipId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/delete.md b/docs/examples/1.7.x/client-apple/examples/teams/delete.md new file mode 100644 index 0000000000..1787b4c749 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/delete.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let result = try await teams.delete( + teamId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/get-membership.md b/docs/examples/1.7.x/client-apple/examples/teams/get-membership.md new file mode 100644 index 0000000000..837a92dd04 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/get-membership.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let membership = try await teams.getMembership( + teamId: "", + membershipId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/get-prefs.md b/docs/examples/1.7.x/client-apple/examples/teams/get-prefs.md new file mode 100644 index 0000000000..b5b17a3bc2 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/get-prefs.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let preferences = try await teams.getPrefs( + teamId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/get.md b/docs/examples/1.7.x/client-apple/examples/teams/get.md new file mode 100644 index 0000000000..af358fbb67 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/get.md @@ -0,0 +1,12 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let team = try await teams.get( + teamId: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/list-memberships.md b/docs/examples/1.7.x/client-apple/examples/teams/list-memberships.md new file mode 100644 index 0000000000..5c8669a3d8 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/list-memberships.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let membershipList = try await teams.listMemberships( + teamId: "", + queries: [], // optional + search: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/list.md b/docs/examples/1.7.x/client-apple/examples/teams/list.md new file mode 100644 index 0000000000..be81e9c5aa --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/list.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let teamList = try await teams.list( + queries: [], // optional + search: "" // optional +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/update-membership-status.md b/docs/examples/1.7.x/client-apple/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..1f3cb39d92 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/update-membership-status.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let membership = try await teams.updateMembershipStatus( + teamId: "", + membershipId: "", + userId: "", + secret: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/update-membership.md b/docs/examples/1.7.x/client-apple/examples/teams/update-membership.md new file mode 100644 index 0000000000..eaa61799c2 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/update-membership.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let membership = try await teams.updateMembership( + teamId: "", + membershipId: "", + roles: [] +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/update-name.md b/docs/examples/1.7.x/client-apple/examples/teams/update-name.md new file mode 100644 index 0000000000..ce5188b950 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/update-name.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let team = try await teams.updateName( + teamId: "", + name: "" +) + diff --git a/docs/examples/1.7.x/client-apple/examples/teams/update-prefs.md b/docs/examples/1.7.x/client-apple/examples/teams/update-prefs.md new file mode 100644 index 0000000000..e20ec2ea18 --- /dev/null +++ b/docs/examples/1.7.x/client-apple/examples/teams/update-prefs.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("") // Your project ID + +let teams = Teams(client) + +let preferences = try await teams.updatePrefs( + teamId: "", + prefs: [:] +) + diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/client-flutter/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..cdcd98ddb2 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-anonymous-session.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.createAnonymousSession(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-email-password-session.md b/docs/examples/1.7.x/client-flutter/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..66bc2ab5f4 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-email-password-session.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.createEmailPasswordSession( + email: 'email@example.com', + password: 'password', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-email-token.md b/docs/examples/1.7.x/client-flutter/examples/account/create-email-token.md new file mode 100644 index 0000000000..2640894502 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-email-token.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.createEmailToken( + userId: '', + email: 'email@example.com', + phrase: false, // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-j-w-t.md b/docs/examples/1.7.x/client-flutter/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..b9cbc8f5a5 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-j-w-t.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Jwt result = await account.createJWT(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/client-flutter/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..454a951022 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,14 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.createMagicURLToken( + userId: '', + email: 'email@example.com', + url: 'https://example.com', // optional + phrase: false, // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/client-flutter/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..ca66149654 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-mfa-authenticator.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +MfaType result = await account.createMfaAuthenticator( + type: AuthenticatorType.totp, +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/client-flutter/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..6815e5c52f --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-mfa-challenge.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +MfaChallenge result = await account.createMfaChallenge( + factor: AuthenticationFactor.email, +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/client-flutter/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..274dc598a8 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +MfaRecoveryCodes result = await account.createMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-o-auth2session.md b/docs/examples/1.7.x/client-flutter/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..ab53f4a777 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-o-auth2session.md @@ -0,0 +1,14 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +await account.createOAuth2Session( + provider: OAuthProvider.amazon, + success: 'https://example.com', // optional + failure: 'https://example.com', // optional + scopes: [], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/client-flutter/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..d6b6c72c7e --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-o-auth2token.md @@ -0,0 +1,14 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +await account.createOAuth2Token( + provider: OAuthProvider.amazon, + success: 'https://example.com', // optional + failure: 'https://example.com', // optional + scopes: [], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-phone-token.md b/docs/examples/1.7.x/client-flutter/examples/account/create-phone-token.md new file mode 100644 index 0000000000..ff0187f0dc --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-phone-token.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.createPhoneToken( + userId: '', + phone: '+12065550100', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-phone-verification.md b/docs/examples/1.7.x/client-flutter/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..11e215a060 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-phone-verification.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.createPhoneVerification(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-push-target.md b/docs/examples/1.7.x/client-flutter/examples/account/create-push-target.md new file mode 100644 index 0000000000..fd1755e3c5 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-push-target.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Target result = await account.createPushTarget( + targetId: '', + identifier: '', + providerId: '', // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-recovery.md b/docs/examples/1.7.x/client-flutter/examples/account/create-recovery.md new file mode 100644 index 0000000000..44985beb80 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-recovery.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.createRecovery( + email: 'email@example.com', + url: 'https://example.com', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-session.md b/docs/examples/1.7.x/client-flutter/examples/account/create-session.md new file mode 100644 index 0000000000..e54e68a317 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-session.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.createSession( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create-verification.md b/docs/examples/1.7.x/client-flutter/examples/account/create-verification.md new file mode 100644 index 0000000000..8f96997249 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create-verification.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.createVerification( + url: 'https://example.com', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/create.md b/docs/examples/1.7.x/client-flutter/examples/account/create.md new file mode 100644 index 0000000000..ae0d526944 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/create.md @@ -0,0 +1,14 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.create( + userId: '', + email: 'email@example.com', + password: '', + name: '', // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/delete-identity.md b/docs/examples/1.7.x/client-flutter/examples/account/delete-identity.md new file mode 100644 index 0000000000..849fa726a4 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/delete-identity.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +await account.deleteIdentity( + identityId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/client-flutter/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..bf4b0c509b --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +await account.deleteMfaAuthenticator( + type: AuthenticatorType.totp, +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/delete-push-target.md b/docs/examples/1.7.x/client-flutter/examples/account/delete-push-target.md new file mode 100644 index 0000000000..6393d4ed4e --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/delete-push-target.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +await account.deletePushTarget( + targetId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/delete-session.md b/docs/examples/1.7.x/client-flutter/examples/account/delete-session.md new file mode 100644 index 0000000000..55abb18c85 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/delete-session.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +await account.deleteSession( + sessionId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/delete-sessions.md b/docs/examples/1.7.x/client-flutter/examples/account/delete-sessions.md new file mode 100644 index 0000000000..c50b611cac --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/delete-sessions.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +await account.deleteSessions(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/client-flutter/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..f9d50131e5 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +MfaRecoveryCodes result = await account.getMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/get-prefs.md b/docs/examples/1.7.x/client-flutter/examples/account/get-prefs.md new file mode 100644 index 0000000000..9332da3a63 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/get-prefs.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Preferences result = await account.getPrefs(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/get-session.md b/docs/examples/1.7.x/client-flutter/examples/account/get-session.md new file mode 100644 index 0000000000..d68afcecd2 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/get-session.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.getSession( + sessionId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/get.md b/docs/examples/1.7.x/client-flutter/examples/account/get.md new file mode 100644 index 0000000000..a318617f78 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/get.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.get(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/list-identities.md b/docs/examples/1.7.x/client-flutter/examples/account/list-identities.md new file mode 100644 index 0000000000..9d2ad83c17 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/list-identities.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +IdentityList result = await account.listIdentities( + queries: [], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/list-logs.md b/docs/examples/1.7.x/client-flutter/examples/account/list-logs.md new file mode 100644 index 0000000000..6d9b120991 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/list-logs.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +LogList result = await account.listLogs( + queries: [], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/client-flutter/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..9f945400ac --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/list-mfa-factors.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +MfaFactors result = await account.listMfaFactors(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/list-sessions.md b/docs/examples/1.7.x/client-flutter/examples/account/list-sessions.md new file mode 100644 index 0000000000..fd1d0e080c --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/list-sessions.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +SessionList result = await account.listSessions(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-email.md b/docs/examples/1.7.x/client-flutter/examples/account/update-email.md new file mode 100644 index 0000000000..0f3d998284 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-email.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.updateEmail( + email: 'email@example.com', + password: 'password', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-m-f-a.md b/docs/examples/1.7.x/client-flutter/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..fc81c565ed --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-m-f-a.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.updateMFA( + mfa: false, +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/client-flutter/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..d0f91eb0a4 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.updateMagicURLSession( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/client-flutter/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..7f026578c5 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-mfa-authenticator.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.updateMfaAuthenticator( + type: AuthenticatorType.totp, + otp: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/client-flutter/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..a938f0af68 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-mfa-challenge.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.updateMfaChallenge( + challengeId: '', + otp: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/client-flutter/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..37334ef69a --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +MfaRecoveryCodes result = await account.updateMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-name.md b/docs/examples/1.7.x/client-flutter/examples/account/update-name.md new file mode 100644 index 0000000000..303a12351f --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-name.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.updateName( + name: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-password.md b/docs/examples/1.7.x/client-flutter/examples/account/update-password.md new file mode 100644 index 0000000000..835d2383ca --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-password.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.updatePassword( + password: '', + oldPassword: 'password', // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-phone-session.md b/docs/examples/1.7.x/client-flutter/examples/account/update-phone-session.md new file mode 100644 index 0000000000..36801792f6 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-phone-session.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.updatePhoneSession( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-phone-verification.md b/docs/examples/1.7.x/client-flutter/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..f5bbb773d0 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-phone-verification.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.updatePhoneVerification( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-phone.md b/docs/examples/1.7.x/client-flutter/examples/account/update-phone.md new file mode 100644 index 0000000000..6390d14245 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-phone.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.updatePhone( + phone: '+12065550100', + password: 'password', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-prefs.md b/docs/examples/1.7.x/client-flutter/examples/account/update-prefs.md new file mode 100644 index 0000000000..81fa362f89 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-prefs.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.updatePrefs( + prefs: {}, +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-push-target.md b/docs/examples/1.7.x/client-flutter/examples/account/update-push-target.md new file mode 100644 index 0000000000..c695ea0984 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-push-target.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Target result = await account.updatePushTarget( + targetId: '', + identifier: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-recovery.md b/docs/examples/1.7.x/client-flutter/examples/account/update-recovery.md new file mode 100644 index 0000000000..5ca0239f47 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-recovery.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.updateRecovery( + userId: '', + secret: '', + password: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-session.md b/docs/examples/1.7.x/client-flutter/examples/account/update-session.md new file mode 100644 index 0000000000..4c78ebb187 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-session.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.updateSession( + sessionId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-status.md b/docs/examples/1.7.x/client-flutter/examples/account/update-status.md new file mode 100644 index 0000000000..289a3f0a96 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-status.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.updateStatus(); diff --git a/docs/examples/1.7.x/client-flutter/examples/account/update-verification.md b/docs/examples/1.7.x/client-flutter/examples/account/update-verification.md new file mode 100644 index 0000000000..15c7ed1928 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/account/update-verification.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.updateVerification( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/avatars/get-browser.md b/docs/examples/1.7.x/client-flutter/examples/avatars/get-browser.md new file mode 100644 index 0000000000..e97d24ab4f --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/avatars/get-browser.md @@ -0,0 +1,33 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Avatars avatars = Avatars(client); + +// Downloading file +UInt8List bytes = await avatars.getBrowser( + code: Browser.avantBrowser, + width: 0, // optional + height: 0, // optional + quality: -1, // optional +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: avatars.getBrowser( + code: Browser.avantBrowser, + width:0 , // optional + height:0 , // optional + quality:-1 , // optional +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/client-flutter/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..9ec42588b4 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/avatars/get-credit-card.md @@ -0,0 +1,33 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Avatars avatars = Avatars(client); + +// Downloading file +UInt8List bytes = await avatars.getCreditCard( + code: CreditCard.americanExpress, + width: 0, // optional + height: 0, // optional + quality: -1, // optional +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: avatars.getCreditCard( + code: CreditCard.americanExpress, + width:0 , // optional + height:0 , // optional + quality:-1 , // optional +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/avatars/get-favicon.md b/docs/examples/1.7.x/client-flutter/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..0df5ed0d2a --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/avatars/get-favicon.md @@ -0,0 +1,27 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Avatars avatars = Avatars(client); + +// Downloading file +UInt8List bytes = await avatars.getFavicon( + url: 'https://example.com', +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: avatars.getFavicon( + url:'https://example.com' , +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/avatars/get-flag.md b/docs/examples/1.7.x/client-flutter/examples/avatars/get-flag.md new file mode 100644 index 0000000000..99d43409a0 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/avatars/get-flag.md @@ -0,0 +1,33 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Avatars avatars = Avatars(client); + +// Downloading file +UInt8List bytes = await avatars.getFlag( + code: Flag.afghanistan, + width: 0, // optional + height: 0, // optional + quality: -1, // optional +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: avatars.getFlag( + code: Flag.afghanistan, + width:0 , // optional + height:0 , // optional + quality:-1 , // optional +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/avatars/get-image.md b/docs/examples/1.7.x/client-flutter/examples/avatars/get-image.md new file mode 100644 index 0000000000..5b9d1b58c1 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/avatars/get-image.md @@ -0,0 +1,31 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Avatars avatars = Avatars(client); + +// Downloading file +UInt8List bytes = await avatars.getImage( + url: 'https://example.com', + width: 0, // optional + height: 0, // optional +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: avatars.getImage( + url:'https://example.com' , + width:0 , // optional + height:0 , // optional +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/avatars/get-initials.md b/docs/examples/1.7.x/client-flutter/examples/avatars/get-initials.md new file mode 100644 index 0000000000..0c5b62a309 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/avatars/get-initials.md @@ -0,0 +1,33 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Avatars avatars = Avatars(client); + +// Downloading file +UInt8List bytes = await avatars.getInitials( + name: '', // optional + width: 0, // optional + height: 0, // optional + background: '', // optional +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: avatars.getInitials( + name:'' , // optional + width:0 , // optional + height:0 , // optional + background:'' , // optional +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/avatars/get-q-r.md b/docs/examples/1.7.x/client-flutter/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..d9a533c886 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/avatars/get-q-r.md @@ -0,0 +1,33 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Avatars avatars = Avatars(client); + +// Downloading file +UInt8List bytes = await avatars.getQR( + text: '', + size: 1, // optional + margin: 0, // optional + download: false, // optional +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: avatars.getQR( + text:'' , + size:1 , // optional + margin:0 , // optional + download:false , // optional +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/databases/create-document.md b/docs/examples/1.7.x/client-flutter/examples/databases/create-document.md new file mode 100644 index 0000000000..4f286fff95 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/databases/create-document.md @@ -0,0 +1,17 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setKey('') // + .setJWT(''); // Your secret JSON Web Token + +Databases databases = Databases(client); + +Document result = await databases.createDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: {}, + permissions: ["read("any")"], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/databases/delete-document.md b/docs/examples/1.7.x/client-flutter/examples/databases/delete-document.md new file mode 100644 index 0000000000..3354917c20 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/databases/delete-document.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Databases databases = Databases(client); + +await databases.deleteDocument( + databaseId: '', + collectionId: '', + documentId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/databases/get-document.md b/docs/examples/1.7.x/client-flutter/examples/databases/get-document.md new file mode 100644 index 0000000000..f85c1f9b5a --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/databases/get-document.md @@ -0,0 +1,14 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Databases databases = Databases(client); + +Document result = await databases.getDocument( + databaseId: '', + collectionId: '', + documentId: '', + queries: [], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/databases/list-documents.md b/docs/examples/1.7.x/client-flutter/examples/databases/list-documents.md new file mode 100644 index 0000000000..31fec1f522 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/databases/list-documents.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Databases databases = Databases(client); + +DocumentList result = await databases.listDocuments( + databaseId: '', + collectionId: '', + queries: [], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/databases/update-document.md b/docs/examples/1.7.x/client-flutter/examples/databases/update-document.md new file mode 100644 index 0000000000..1f444d875a --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/databases/update-document.md @@ -0,0 +1,15 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Databases databases = Databases(client); + +Document result = await databases.updateDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: {}, // optional + permissions: ["read("any")"], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/functions/create-execution.md b/docs/examples/1.7.x/client-flutter/examples/functions/create-execution.md new file mode 100644 index 0000000000..d2a3d9e00a --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/functions/create-execution.md @@ -0,0 +1,17 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Functions functions = Functions(client); + +Execution result = await functions.createExecution( + functionId: '', + body: '', // optional + xasync: false, // optional + path: '', // optional + method: ExecutionMethod.gET, // optional + headers: {}, // optional + scheduledAt: '', // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/functions/get-execution.md b/docs/examples/1.7.x/client-flutter/examples/functions/get-execution.md new file mode 100644 index 0000000000..714933be32 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/functions/get-execution.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Functions functions = Functions(client); + +Execution result = await functions.getExecution( + functionId: '', + executionId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/functions/list-executions.md b/docs/examples/1.7.x/client-flutter/examples/functions/list-executions.md new file mode 100644 index 0000000000..232f3250d3 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/functions/list-executions.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Functions functions = Functions(client); + +ExecutionList result = await functions.listExecutions( + functionId: '', + queries: [], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/graphql/mutation.md b/docs/examples/1.7.x/client-flutter/examples/graphql/mutation.md new file mode 100644 index 0000000000..60f0c29703 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/graphql/mutation.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Graphql graphql = Graphql(client); + +Any result = await graphql.mutation( + query: {}, +); diff --git a/docs/examples/1.7.x/client-flutter/examples/graphql/query.md b/docs/examples/1.7.x/client-flutter/examples/graphql/query.md new file mode 100644 index 0000000000..d90c3432e9 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/graphql/query.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Graphql graphql = Graphql(client); + +Any result = await graphql.query( + query: {}, +); diff --git a/docs/examples/1.7.x/client-flutter/examples/locale/get.md b/docs/examples/1.7.x/client-flutter/examples/locale/get.md new file mode 100644 index 0000000000..b284699046 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/locale/get.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Locale locale = Locale(client); + +Locale result = await locale.get(); diff --git a/docs/examples/1.7.x/client-flutter/examples/locale/list-codes.md b/docs/examples/1.7.x/client-flutter/examples/locale/list-codes.md new file mode 100644 index 0000000000..0227471571 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/locale/list-codes.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Locale locale = Locale(client); + +LocaleCodeList result = await locale.listCodes(); diff --git a/docs/examples/1.7.x/client-flutter/examples/locale/list-continents.md b/docs/examples/1.7.x/client-flutter/examples/locale/list-continents.md new file mode 100644 index 0000000000..1098bd1d58 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/locale/list-continents.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Locale locale = Locale(client); + +ContinentList result = await locale.listContinents(); diff --git a/docs/examples/1.7.x/client-flutter/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/client-flutter/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..7d6571f4ee --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/locale/list-countries-e-u.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Locale locale = Locale(client); + +CountryList result = await locale.listCountriesEU(); diff --git a/docs/examples/1.7.x/client-flutter/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/client-flutter/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..395f240fd7 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/locale/list-countries-phones.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Locale locale = Locale(client); + +PhoneList result = await locale.listCountriesPhones(); diff --git a/docs/examples/1.7.x/client-flutter/examples/locale/list-countries.md b/docs/examples/1.7.x/client-flutter/examples/locale/list-countries.md new file mode 100644 index 0000000000..a322eb2078 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/locale/list-countries.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Locale locale = Locale(client); + +CountryList result = await locale.listCountries(); diff --git a/docs/examples/1.7.x/client-flutter/examples/locale/list-currencies.md b/docs/examples/1.7.x/client-flutter/examples/locale/list-currencies.md new file mode 100644 index 0000000000..8884bf45b2 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/locale/list-currencies.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Locale locale = Locale(client); + +CurrencyList result = await locale.listCurrencies(); diff --git a/docs/examples/1.7.x/client-flutter/examples/locale/list-languages.md b/docs/examples/1.7.x/client-flutter/examples/locale/list-languages.md new file mode 100644 index 0000000000..0444d94151 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/locale/list-languages.md @@ -0,0 +1,9 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Locale locale = Locale(client); + +LanguageList result = await locale.listLanguages(); diff --git a/docs/examples/1.7.x/client-flutter/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/client-flutter/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..2a278a0481 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/messaging/create-subscriber.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Messaging messaging = Messaging(client); + +Subscriber result = await messaging.createSubscriber( + topicId: '', + subscriberId: '', + targetId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/client-flutter/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..02c1f61535 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/messaging/delete-subscriber.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Messaging messaging = Messaging(client); + +await messaging.deleteSubscriber( + topicId: '', + subscriberId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/storage/create-file.md b/docs/examples/1.7.x/client-flutter/examples/storage/create-file.md new file mode 100644 index 0000000000..661f6b8b1e --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/storage/create-file.md @@ -0,0 +1,15 @@ +import 'dart:io'; +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Storage storage = Storage(client); + +File result = await storage.createFile( + bucketId: '', + fileId: '', + file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), + permissions: ["read("any")"], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/storage/delete-file.md b/docs/examples/1.7.x/client-flutter/examples/storage/delete-file.md new file mode 100644 index 0000000000..b2c6a78f75 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/storage/delete-file.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Storage storage = Storage(client); + +await storage.deleteFile( + bucketId: '', + fileId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/storage/get-file-download.md b/docs/examples/1.7.x/client-flutter/examples/storage/get-file-download.md new file mode 100644 index 0000000000..5bef06ee7d --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/storage/get-file-download.md @@ -0,0 +1,31 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Storage storage = Storage(client); + +// Downloading file +UInt8List bytes = await storage.getFileDownload( + bucketId: '', + fileId: '', + token: '', // optional +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: storage.getFileDownload( + bucketId:'' , + fileId:'' , + token:'' , // optional +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/storage/get-file-preview.md b/docs/examples/1.7.x/client-flutter/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..96338bd25a --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/storage/get-file-preview.md @@ -0,0 +1,53 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Storage storage = Storage(client); + +// Downloading file +UInt8List bytes = await storage.getFilePreview( + bucketId: '', + fileId: '', + width: 0, // optional + height: 0, // optional + gravity: ImageGravity.center, // optional + quality: -1, // optional + borderWidth: 0, // optional + borderColor: '', // optional + borderRadius: 0, // optional + opacity: 0, // optional + rotation: -360, // optional + background: '', // optional + output: ImageFormat.jpg, // optional + token: '', // optional +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: storage.getFilePreview( + bucketId:'' , + fileId:'' , + width:0 , // optional + height:0 , // optional + gravity: ImageGravity.center, // optional + quality:-1 , // optional + borderWidth:0 , // optional + borderColor:'' , // optional + borderRadius:0 , // optional + opacity:0 , // optional + rotation:-360 , // optional + background:'' , // optional + output: ImageFormat.jpg, // optional + token:'' , // optional +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/storage/get-file-view.md b/docs/examples/1.7.x/client-flutter/examples/storage/get-file-view.md new file mode 100644 index 0000000000..6587f086bd --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/storage/get-file-view.md @@ -0,0 +1,31 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Storage storage = Storage(client); + +// Downloading file +UInt8List bytes = await storage.getFileView( + bucketId: '', + fileId: '', + token: '', // optional +) + +final file = File('path_to_file/filename.ext'); +file.writeAsBytesSync(bytes); + +// Displaying image preview +FutureBuilder( + future: storage.getFileView( + bucketId:'' , + fileId:'' , + token:'' , // optional +), // Works for both public file and private file, for private files you need to be logged in + builder: (context, snapshot) { + return snapshot.hasData && snapshot.data != null + ? Image.memory(snapshot.data) + : CircularProgressIndicator(); + } +); diff --git a/docs/examples/1.7.x/client-flutter/examples/storage/get-file.md b/docs/examples/1.7.x/client-flutter/examples/storage/get-file.md new file mode 100644 index 0000000000..f4b541ffd1 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/storage/get-file.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Storage storage = Storage(client); + +File result = await storage.getFile( + bucketId: '', + fileId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/storage/list-files.md b/docs/examples/1.7.x/client-flutter/examples/storage/list-files.md new file mode 100644 index 0000000000..7950005b6a --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/storage/list-files.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Storage storage = Storage(client); + +FileList result = await storage.listFiles( + bucketId: '', + queries: [], // optional + search: '', // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/storage/update-file.md b/docs/examples/1.7.x/client-flutter/examples/storage/update-file.md new file mode 100644 index 0000000000..8e598121c1 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/storage/update-file.md @@ -0,0 +1,14 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Storage storage = Storage(client); + +File result = await storage.updateFile( + bucketId: '', + fileId: '', + name: '', // optional + permissions: ["read("any")"], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/create-membership.md b/docs/examples/1.7.x/client-flutter/examples/teams/create-membership.md new file mode 100644 index 0000000000..8026521408 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/create-membership.md @@ -0,0 +1,17 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +Membership result = await teams.createMembership( + teamId: '', + roles: [], + email: 'email@example.com', // optional + userId: '', // optional + phone: '+12065550100', // optional + url: 'https://example.com', // optional + name: '', // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/create.md b/docs/examples/1.7.x/client-flutter/examples/teams/create.md new file mode 100644 index 0000000000..637e216a04 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/create.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +Team result = await teams.create( + teamId: '', + name: '', + roles: [], // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/delete-membership.md b/docs/examples/1.7.x/client-flutter/examples/teams/delete-membership.md new file mode 100644 index 0000000000..0f1941d88b --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/delete-membership.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +await teams.deleteMembership( + teamId: '', + membershipId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/delete.md b/docs/examples/1.7.x/client-flutter/examples/teams/delete.md new file mode 100644 index 0000000000..74c74c9cf1 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/delete.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +await teams.delete( + teamId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/get-membership.md b/docs/examples/1.7.x/client-flutter/examples/teams/get-membership.md new file mode 100644 index 0000000000..468e02cf32 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/get-membership.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +Membership result = await teams.getMembership( + teamId: '', + membershipId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/get-prefs.md b/docs/examples/1.7.x/client-flutter/examples/teams/get-prefs.md new file mode 100644 index 0000000000..a22c78869c --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/get-prefs.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +Preferences result = await teams.getPrefs( + teamId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/get.md b/docs/examples/1.7.x/client-flutter/examples/teams/get.md new file mode 100644 index 0000000000..5e8c3463ea --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/get.md @@ -0,0 +1,11 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +Team result = await teams.get( + teamId: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/list-memberships.md b/docs/examples/1.7.x/client-flutter/examples/teams/list-memberships.md new file mode 100644 index 0000000000..374dd49069 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/list-memberships.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +MembershipList result = await teams.listMemberships( + teamId: '', + queries: [], // optional + search: '', // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/list.md b/docs/examples/1.7.x/client-flutter/examples/teams/list.md new file mode 100644 index 0000000000..3aa972fb5f --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/list.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +TeamList result = await teams.list( + queries: [], // optional + search: '', // optional +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/update-membership-status.md b/docs/examples/1.7.x/client-flutter/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..1ce3eacb79 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/update-membership-status.md @@ -0,0 +1,14 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +Membership result = await teams.updateMembershipStatus( + teamId: '', + membershipId: '', + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/update-membership.md b/docs/examples/1.7.x/client-flutter/examples/teams/update-membership.md new file mode 100644 index 0000000000..bc2bbae75c --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/update-membership.md @@ -0,0 +1,13 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +Membership result = await teams.updateMembership( + teamId: '', + membershipId: '', + roles: [], +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/update-name.md b/docs/examples/1.7.x/client-flutter/examples/teams/update-name.md new file mode 100644 index 0000000000..8f1794587e --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/update-name.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +Team result = await teams.updateName( + teamId: '', + name: '', +); diff --git a/docs/examples/1.7.x/client-flutter/examples/teams/update-prefs.md b/docs/examples/1.7.x/client-flutter/examples/teams/update-prefs.md new file mode 100644 index 0000000000..7b33c8c313 --- /dev/null +++ b/docs/examples/1.7.x/client-flutter/examples/teams/update-prefs.md @@ -0,0 +1,12 @@ +import 'package:appwrite/appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Teams teams = Teams(client); + +Preferences result = await teams.updatePrefs( + teamId: '', + prefs: {}, +); diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/client-graphql/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..92c12acee5 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-anonymous-session.md @@ -0,0 +1,33 @@ +mutation { + accountCreateAnonymousSession { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-email-password-session.md b/docs/examples/1.7.x/client-graphql/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..931bb4add0 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-email-password-session.md @@ -0,0 +1,36 @@ +mutation { + accountCreateEmailPasswordSession( + email: "email@example.com", + password: "password" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-email-token.md b/docs/examples/1.7.x/client-graphql/examples/account/create-email-token.md new file mode 100644 index 0000000000..de320b45ed --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-email-token.md @@ -0,0 +1,14 @@ +mutation { + accountCreateEmailToken( + userId: "", + email: "email@example.com", + phrase: false + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-j-w-t.md b/docs/examples/1.7.x/client-graphql/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..a5204f1256 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-j-w-t.md @@ -0,0 +1,5 @@ +mutation { + accountCreateJWT { + jwt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/client-graphql/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..4024a5b3a9 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,15 @@ +mutation { + accountCreateMagicURLToken( + userId: "", + email: "email@example.com", + url: "https://example.com", + phrase: false + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/client-graphql/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..6b29292494 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-mfa-authenticator.md @@ -0,0 +1,8 @@ +mutation { + accountCreateMfaAuthenticator( + type: "totp" + ) { + secret + uri + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/client-graphql/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..eb5cba127d --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-mfa-challenge.md @@ -0,0 +1,10 @@ +mutation { + accountCreateMfaChallenge( + factor: "email" + ) { + _id + _createdAt + userId + expire + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/client-graphql/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..f39b7d080d --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,5 @@ +mutation { + accountCreateMfaRecoveryCodes { + recoveryCodes + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-phone-token.md b/docs/examples/1.7.x/client-graphql/examples/account/create-phone-token.md new file mode 100644 index 0000000000..b56c4eb4e4 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-phone-token.md @@ -0,0 +1,13 @@ +mutation { + accountCreatePhoneToken( + userId: "", + phone: "+12065550100" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-phone-verification.md b/docs/examples/1.7.x/client-graphql/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..a4cad59b1a --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-phone-verification.md @@ -0,0 +1,10 @@ +mutation { + accountCreatePhoneVerification { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-push-target.md b/docs/examples/1.7.x/client-graphql/examples/account/create-push-target.md new file mode 100644 index 0000000000..63802a782e --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-push-target.md @@ -0,0 +1,17 @@ +mutation { + accountCreatePushTarget( + targetId: "", + identifier: "", + providerId: "" + ) { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-recovery.md b/docs/examples/1.7.x/client-graphql/examples/account/create-recovery.md new file mode 100644 index 0000000000..ad31fd82d7 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-recovery.md @@ -0,0 +1,13 @@ +mutation { + accountCreateRecovery( + email: "email@example.com", + url: "https://example.com" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-session.md b/docs/examples/1.7.x/client-graphql/examples/account/create-session.md new file mode 100644 index 0000000000..f473d14207 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-session.md @@ -0,0 +1,36 @@ +mutation { + accountCreateSession( + userId: "", + secret: "" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create-verification.md b/docs/examples/1.7.x/client-graphql/examples/account/create-verification.md new file mode 100644 index 0000000000..df50dda529 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create-verification.md @@ -0,0 +1,12 @@ +mutation { + accountCreateVerification( + url: "https://example.com" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/create.md b/docs/examples/1.7.x/client-graphql/examples/account/create.md new file mode 100644 index 0000000000..0d39394a3d --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/create.md @@ -0,0 +1,40 @@ +mutation { + accountCreate( + userId: "", + email: "email@example.com", + password: "", + name: "" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/delete-identity.md b/docs/examples/1.7.x/client-graphql/examples/account/delete-identity.md new file mode 100644 index 0000000000..f3c2e2e7b9 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/delete-identity.md @@ -0,0 +1,7 @@ +mutation { + accountDeleteIdentity( + identityId: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/client-graphql/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..fc5486623a --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,7 @@ +mutation { + accountDeleteMfaAuthenticator( + type: "totp" + ) { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/delete-push-target.md b/docs/examples/1.7.x/client-graphql/examples/account/delete-push-target.md new file mode 100644 index 0000000000..894c0b2e02 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/delete-push-target.md @@ -0,0 +1,7 @@ +mutation { + accountDeletePushTarget( + targetId: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/delete-session.md b/docs/examples/1.7.x/client-graphql/examples/account/delete-session.md new file mode 100644 index 0000000000..09aff38fdd --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/delete-session.md @@ -0,0 +1,7 @@ +mutation { + accountDeleteSession( + sessionId: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/delete-sessions.md b/docs/examples/1.7.x/client-graphql/examples/account/delete-sessions.md new file mode 100644 index 0000000000..b0d61daa81 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/delete-sessions.md @@ -0,0 +1,5 @@ +mutation { + accountDeleteSessions { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/client-graphql/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/account/get-prefs.md b/docs/examples/1.7.x/client-graphql/examples/account/get-prefs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/account/get-session.md b/docs/examples/1.7.x/client-graphql/examples/account/get-session.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/account/get.md b/docs/examples/1.7.x/client-graphql/examples/account/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/account/list-identities.md b/docs/examples/1.7.x/client-graphql/examples/account/list-identities.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/account/list-logs.md b/docs/examples/1.7.x/client-graphql/examples/account/list-logs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/client-graphql/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/account/list-sessions.md b/docs/examples/1.7.x/client-graphql/examples/account/list-sessions.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-email.md b/docs/examples/1.7.x/client-graphql/examples/account/update-email.md new file mode 100644 index 0000000000..c879e24a43 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-email.md @@ -0,0 +1,38 @@ +mutation { + accountUpdateEmail( + email: "email@example.com", + password: "password" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-m-f-a.md b/docs/examples/1.7.x/client-graphql/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..787c2e0860 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-m-f-a.md @@ -0,0 +1,37 @@ +mutation { + accountUpdateMFA( + mfa: false + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/client-graphql/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..075bc91d17 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,36 @@ +mutation { + accountUpdateMagicURLSession( + userId: "", + secret: "" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/client-graphql/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..9cfe9150be --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-mfa-authenticator.md @@ -0,0 +1,38 @@ +mutation { + accountUpdateMfaAuthenticator( + type: "totp", + otp: "" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/client-graphql/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..0bcec2157f --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-mfa-challenge.md @@ -0,0 +1,36 @@ +mutation { + accountUpdateMfaChallenge( + challengeId: "", + otp: "" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/client-graphql/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..e706d2b9d7 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,5 @@ +mutation { + accountUpdateMfaRecoveryCodes { + recoveryCodes + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-name.md b/docs/examples/1.7.x/client-graphql/examples/account/update-name.md new file mode 100644 index 0000000000..8ba2c99d9c --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-name.md @@ -0,0 +1,37 @@ +mutation { + accountUpdateName( + name: "" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-password.md b/docs/examples/1.7.x/client-graphql/examples/account/update-password.md new file mode 100644 index 0000000000..f3619a10d2 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-password.md @@ -0,0 +1,38 @@ +mutation { + accountUpdatePassword( + password: "", + oldPassword: "password" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-phone-session.md b/docs/examples/1.7.x/client-graphql/examples/account/update-phone-session.md new file mode 100644 index 0000000000..199e774ab0 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-phone-session.md @@ -0,0 +1,36 @@ +mutation { + accountUpdatePhoneSession( + userId: "", + secret: "" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-phone-verification.md b/docs/examples/1.7.x/client-graphql/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..dd62298bb9 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-phone-verification.md @@ -0,0 +1,13 @@ +mutation { + accountUpdatePhoneVerification( + userId: "", + secret: "" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-phone.md b/docs/examples/1.7.x/client-graphql/examples/account/update-phone.md new file mode 100644 index 0000000000..adecb71168 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-phone.md @@ -0,0 +1,38 @@ +mutation { + accountUpdatePhone( + phone: "+12065550100", + password: "password" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-prefs.md b/docs/examples/1.7.x/client-graphql/examples/account/update-prefs.md new file mode 100644 index 0000000000..57280247e4 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-prefs.md @@ -0,0 +1,37 @@ +mutation { + accountUpdatePrefs( + prefs: "{}" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-push-target.md b/docs/examples/1.7.x/client-graphql/examples/account/update-push-target.md new file mode 100644 index 0000000000..3c402cdf12 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-push-target.md @@ -0,0 +1,16 @@ +mutation { + accountUpdatePushTarget( + targetId: "", + identifier: "" + ) { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-recovery.md b/docs/examples/1.7.x/client-graphql/examples/account/update-recovery.md new file mode 100644 index 0000000000..2d15fdcaa1 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-recovery.md @@ -0,0 +1,14 @@ +mutation { + accountUpdateRecovery( + userId: "", + secret: "", + password: "" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-session.md b/docs/examples/1.7.x/client-graphql/examples/account/update-session.md new file mode 100644 index 0000000000..29a8979872 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-session.md @@ -0,0 +1,35 @@ +mutation { + accountUpdateSession( + sessionId: "" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-status.md b/docs/examples/1.7.x/client-graphql/examples/account/update-status.md new file mode 100644 index 0000000000..c17f556842 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-status.md @@ -0,0 +1,35 @@ +mutation { + accountUpdateStatus { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/account/update-verification.md b/docs/examples/1.7.x/client-graphql/examples/account/update-verification.md new file mode 100644 index 0000000000..11e63c7da3 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/account/update-verification.md @@ -0,0 +1,13 @@ +mutation { + accountUpdateVerification( + userId: "", + secret: "" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/avatars/get-browser.md b/docs/examples/1.7.x/client-graphql/examples/avatars/get-browser.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/client-graphql/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/avatars/get-favicon.md b/docs/examples/1.7.x/client-graphql/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/avatars/get-flag.md b/docs/examples/1.7.x/client-graphql/examples/avatars/get-flag.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/avatars/get-image.md b/docs/examples/1.7.x/client-graphql/examples/avatars/get-image.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/avatars/get-initials.md b/docs/examples/1.7.x/client-graphql/examples/avatars/get-initials.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/avatars/get-q-r.md b/docs/examples/1.7.x/client-graphql/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/databases/create-document.md b/docs/examples/1.7.x/client-graphql/examples/databases/create-document.md new file mode 100644 index 0000000000..4e2d90660b --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/databases/create-document.md @@ -0,0 +1,17 @@ +mutation { + databasesCreateDocument( + databaseId: "", + collectionId: "", + documentId: "", + data: "{}", + permissions: ["read("any")"] + ) { + _id + _collectionId + _databaseId + _createdAt + _updatedAt + _permissions + data + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/databases/delete-document.md b/docs/examples/1.7.x/client-graphql/examples/databases/delete-document.md new file mode 100644 index 0000000000..848371bca0 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/databases/delete-document.md @@ -0,0 +1,9 @@ +mutation { + databasesDeleteDocument( + databaseId: "", + collectionId: "", + documentId: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/databases/get-document.md b/docs/examples/1.7.x/client-graphql/examples/databases/get-document.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/databases/list-documents.md b/docs/examples/1.7.x/client-graphql/examples/databases/list-documents.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/databases/update-document.md b/docs/examples/1.7.x/client-graphql/examples/databases/update-document.md new file mode 100644 index 0000000000..5e80894620 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/databases/update-document.md @@ -0,0 +1,17 @@ +mutation { + databasesUpdateDocument( + databaseId: "", + collectionId: "", + documentId: "", + data: "{}", + permissions: ["read("any")"] + ) { + _id + _collectionId + _databaseId + _createdAt + _updatedAt + _permissions + data + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/functions/create-execution.md b/docs/examples/1.7.x/client-graphql/examples/functions/create-execution.md new file mode 100644 index 0000000000..1479aa3bb6 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/functions/create-execution.md @@ -0,0 +1,35 @@ +mutation { + functionsCreateExecution( + functionId: "", + body: "", + async: false, + path: "", + method: "GET", + headers: "{}", + scheduledAt: "" + ) { + _id + _createdAt + _updatedAt + _permissions + functionId + trigger + status + requestMethod + requestPath + requestHeaders { + name + value + } + responseStatusCode + responseBody + responseHeaders { + name + value + } + logs + errors + duration + scheduledAt + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/functions/get-execution.md b/docs/examples/1.7.x/client-graphql/examples/functions/get-execution.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/functions/list-executions.md b/docs/examples/1.7.x/client-graphql/examples/functions/list-executions.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/locale/get.md b/docs/examples/1.7.x/client-graphql/examples/locale/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/locale/list-codes.md b/docs/examples/1.7.x/client-graphql/examples/locale/list-codes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/locale/list-continents.md b/docs/examples/1.7.x/client-graphql/examples/locale/list-continents.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/client-graphql/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/client-graphql/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/locale/list-countries.md b/docs/examples/1.7.x/client-graphql/examples/locale/list-countries.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/locale/list-currencies.md b/docs/examples/1.7.x/client-graphql/examples/locale/list-currencies.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/locale/list-languages.md b/docs/examples/1.7.x/client-graphql/examples/locale/list-languages.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/client-graphql/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..bab53612b7 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/messaging/create-subscriber.md @@ -0,0 +1,27 @@ +mutation { + messagingCreateSubscriber( + topicId: "", + subscriberId: "", + targetId: "" + ) { + _id + _createdAt + _updatedAt + targetId + target { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + userId + userName + topicId + providerType + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/client-graphql/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..ededffcaac --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/messaging/delete-subscriber.md @@ -0,0 +1,8 @@ +mutation { + messagingDeleteSubscriber( + topicId: "", + subscriberId: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/storage/create-file.md b/docs/examples/1.7.x/client-graphql/examples/storage/create-file.md new file mode 100644 index 0000000000..97e2150c39 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/storage/create-file.md @@ -0,0 +1,25 @@ +POST /v1/storage/buckets/{bucketId}/files HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: +Content-Length: *Length of your entity body in bytes* + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="operations" + +{ "query": "mutation { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: $file, permissions: $permissions) { id }" }, "variables": { "bucketId": "", "fileId": "", "file": null, "permissions": ["read("any")"] } } + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="map" + +{ "0": ["variables.file"], } + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="0"; filename="file.ext" + +File contents + +--cec8e8123c05ba25-- diff --git a/docs/examples/1.7.x/client-graphql/examples/storage/delete-file.md b/docs/examples/1.7.x/client-graphql/examples/storage/delete-file.md new file mode 100644 index 0000000000..17ec89931a --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/storage/delete-file.md @@ -0,0 +1,8 @@ +mutation { + storageDeleteFile( + bucketId: "", + fileId: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/storage/get-file-download.md b/docs/examples/1.7.x/client-graphql/examples/storage/get-file-download.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/storage/get-file-preview.md b/docs/examples/1.7.x/client-graphql/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/storage/get-file-view.md b/docs/examples/1.7.x/client-graphql/examples/storage/get-file-view.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/storage/get-file.md b/docs/examples/1.7.x/client-graphql/examples/storage/get-file.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/storage/list-files.md b/docs/examples/1.7.x/client-graphql/examples/storage/list-files.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/storage/update-file.md b/docs/examples/1.7.x/client-graphql/examples/storage/update-file.md new file mode 100644 index 0000000000..b7832048c7 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/storage/update-file.md @@ -0,0 +1,20 @@ +mutation { + storageUpdateFile( + bucketId: "", + fileId: "", + name: "", + permissions: ["read("any")"] + ) { + _id + bucketId + _createdAt + _updatedAt + _permissions + name + signature + mimeType + sizeOriginal + chunksTotal + chunksUploaded + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/create-membership.md b/docs/examples/1.7.x/client-graphql/examples/teams/create-membership.md new file mode 100644 index 0000000000..fe741f080d --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/teams/create-membership.md @@ -0,0 +1,25 @@ +mutation { + teamsCreateMembership( + teamId: "", + roles: [], + email: "email@example.com", + userId: "", + phone: "+12065550100", + url: "https://example.com", + name: "" + ) { + _id + _createdAt + _updatedAt + userId + userName + userEmail + teamId + teamName + invited + joined + confirm + mfa + roles + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/create.md b/docs/examples/1.7.x/client-graphql/examples/teams/create.md new file mode 100644 index 0000000000..1f2a7ab3f2 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/teams/create.md @@ -0,0 +1,16 @@ +mutation { + teamsCreate( + teamId: "", + name: "", + roles: [] + ) { + _id + _createdAt + _updatedAt + name + total + prefs { + data + } + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/delete-membership.md b/docs/examples/1.7.x/client-graphql/examples/teams/delete-membership.md new file mode 100644 index 0000000000..e391b6f6fa --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/teams/delete-membership.md @@ -0,0 +1,8 @@ +mutation { + teamsDeleteMembership( + teamId: "", + membershipId: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/delete.md b/docs/examples/1.7.x/client-graphql/examples/teams/delete.md new file mode 100644 index 0000000000..df0d36c5b5 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/teams/delete.md @@ -0,0 +1,7 @@ +mutation { + teamsDelete( + teamId: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/get-membership.md b/docs/examples/1.7.x/client-graphql/examples/teams/get-membership.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/get-prefs.md b/docs/examples/1.7.x/client-graphql/examples/teams/get-prefs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/get.md b/docs/examples/1.7.x/client-graphql/examples/teams/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/list-memberships.md b/docs/examples/1.7.x/client-graphql/examples/teams/list-memberships.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/list.md b/docs/examples/1.7.x/client-graphql/examples/teams/list.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/update-membership-status.md b/docs/examples/1.7.x/client-graphql/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..9b24450a86 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/teams/update-membership-status.md @@ -0,0 +1,22 @@ +mutation { + teamsUpdateMembershipStatus( + teamId: "", + membershipId: "", + userId: "", + secret: "" + ) { + _id + _createdAt + _updatedAt + userId + userName + userEmail + teamId + teamName + invited + joined + confirm + mfa + roles + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/update-membership.md b/docs/examples/1.7.x/client-graphql/examples/teams/update-membership.md new file mode 100644 index 0000000000..1c6a04f078 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/teams/update-membership.md @@ -0,0 +1,21 @@ +mutation { + teamsUpdateMembership( + teamId: "", + membershipId: "", + roles: [] + ) { + _id + _createdAt + _updatedAt + userId + userName + userEmail + teamId + teamName + invited + joined + confirm + mfa + roles + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/update-name.md b/docs/examples/1.7.x/client-graphql/examples/teams/update-name.md new file mode 100644 index 0000000000..c40543b5cd --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/teams/update-name.md @@ -0,0 +1,15 @@ +mutation { + teamsUpdateName( + teamId: "", + name: "" + ) { + _id + _createdAt + _updatedAt + name + total + prefs { + data + } + } +} diff --git a/docs/examples/1.7.x/client-graphql/examples/teams/update-prefs.md b/docs/examples/1.7.x/client-graphql/examples/teams/update-prefs.md new file mode 100644 index 0000000000..95737e33f9 --- /dev/null +++ b/docs/examples/1.7.x/client-graphql/examples/teams/update-prefs.md @@ -0,0 +1,8 @@ +mutation { + teamsUpdatePrefs( + teamId: "", + prefs: "{}" + ) { + data + } +} diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/client-react-native/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..4baad33e9d --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-anonymous-session.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createAnonymousSession(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-email-password-session.md b/docs/examples/1.7.x/client-react-native/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..217d7873ae --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-email-password-session.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createEmailPasswordSession( + 'email@example.com', // email + 'password' // password +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-email-token.md b/docs/examples/1.7.x/client-react-native/examples/account/create-email-token.md new file mode 100644 index 0000000000..b9bdf3bbe2 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-email-token.md @@ -0,0 +1,15 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createEmailToken( + '', // userId + 'email@example.com', // email + false // phrase (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-j-w-t.md b/docs/examples/1.7.x/client-react-native/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..217dc78785 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-j-w-t.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createJWT(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/client-react-native/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..413e347aef --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,16 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createMagicURLToken( + '', // userId + 'email@example.com', // email + 'https://example.com', // url (optional) + false // phrase (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/client-react-native/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..ec243490aa --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-mfa-authenticator.md @@ -0,0 +1,13 @@ +import { Client, Account, AuthenticatorType } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createMfaAuthenticator( + AuthenticatorType.Totp // type +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/client-react-native/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..04de25863f --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-mfa-challenge.md @@ -0,0 +1,13 @@ +import { Client, Account, AuthenticationFactor } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createMfaChallenge( + AuthenticationFactor.Email // factor +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/client-react-native/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..f256be308b --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createMfaRecoveryCodes(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-o-auth2session.md b/docs/examples/1.7.x/client-react-native/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..84bddb4777 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-o-auth2session.md @@ -0,0 +1,15 @@ +import { Client, Account, OAuthProvider } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +account.createOAuth2Session( + OAuthProvider.Amazon, // provider + 'https://example.com', // success (optional) + 'https://example.com', // failure (optional) + [] // scopes (optional) +); + diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/client-react-native/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..cd4ee86aa1 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-o-auth2token.md @@ -0,0 +1,15 @@ +import { Client, Account, OAuthProvider } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +account.createOAuth2Token( + OAuthProvider.Amazon, // provider + 'https://example.com', // success (optional) + 'https://example.com', // failure (optional) + [] // scopes (optional) +); + diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-phone-token.md b/docs/examples/1.7.x/client-react-native/examples/account/create-phone-token.md new file mode 100644 index 0000000000..d03e5ea4bc --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-phone-token.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createPhoneToken( + '', // userId + '+12065550100' // phone +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-phone-verification.md b/docs/examples/1.7.x/client-react-native/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..62bcc48113 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-phone-verification.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createPhoneVerification(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-push-target.md b/docs/examples/1.7.x/client-react-native/examples/account/create-push-target.md new file mode 100644 index 0000000000..83211ab9f3 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-push-target.md @@ -0,0 +1,15 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createPushTarget( + '', // targetId + '', // identifier + '' // providerId (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-recovery.md b/docs/examples/1.7.x/client-react-native/examples/account/create-recovery.md new file mode 100644 index 0000000000..802af82fb7 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-recovery.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createRecovery( + 'email@example.com', // email + 'https://example.com' // url +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-session.md b/docs/examples/1.7.x/client-react-native/examples/account/create-session.md new file mode 100644 index 0000000000..bb3040aef6 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-session.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createSession( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create-verification.md b/docs/examples/1.7.x/client-react-native/examples/account/create-verification.md new file mode 100644 index 0000000000..5fdffcba5c --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create-verification.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createVerification( + 'https://example.com' // url +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/create.md b/docs/examples/1.7.x/client-react-native/examples/account/create.md new file mode 100644 index 0000000000..eb3d04ac54 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/create.md @@ -0,0 +1,16 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.create( + '', // userId + 'email@example.com', // email + '', // password + '' // name (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/delete-identity.md b/docs/examples/1.7.x/client-react-native/examples/account/delete-identity.md new file mode 100644 index 0000000000..df492a528d --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/delete-identity.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deleteIdentity( + '' // identityId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/client-react-native/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..093ba4d5a2 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,13 @@ +import { Client, Account, AuthenticatorType } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deleteMfaAuthenticator( + AuthenticatorType.Totp // type +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/delete-push-target.md b/docs/examples/1.7.x/client-react-native/examples/account/delete-push-target.md new file mode 100644 index 0000000000..a926ede9c6 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/delete-push-target.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deletePushTarget( + '' // targetId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/delete-session.md b/docs/examples/1.7.x/client-react-native/examples/account/delete-session.md new file mode 100644 index 0000000000..134a2caa56 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/delete-session.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deleteSession( + '' // sessionId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/delete-sessions.md b/docs/examples/1.7.x/client-react-native/examples/account/delete-sessions.md new file mode 100644 index 0000000000..830eb273a8 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/delete-sessions.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deleteSessions(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/client-react-native/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..c660a17ab8 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.getMfaRecoveryCodes(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/get-prefs.md b/docs/examples/1.7.x/client-react-native/examples/account/get-prefs.md new file mode 100644 index 0000000000..b26a7b09f0 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/get-prefs.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.getPrefs(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/get-session.md b/docs/examples/1.7.x/client-react-native/examples/account/get-session.md new file mode 100644 index 0000000000..1db05d5c26 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/get-session.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.getSession( + '' // sessionId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/get.md b/docs/examples/1.7.x/client-react-native/examples/account/get.md new file mode 100644 index 0000000000..21d2401601 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/get.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.get(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/list-identities.md b/docs/examples/1.7.x/client-react-native/examples/account/list-identities.md new file mode 100644 index 0000000000..239dbbf21f --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/list-identities.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listIdentities( + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/list-logs.md b/docs/examples/1.7.x/client-react-native/examples/account/list-logs.md new file mode 100644 index 0000000000..9cf441453c --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/list-logs.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listLogs( + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/client-react-native/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..51b76c90e4 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/list-mfa-factors.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listMfaFactors(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/list-sessions.md b/docs/examples/1.7.x/client-react-native/examples/account/list-sessions.md new file mode 100644 index 0000000000..68232be292 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/list-sessions.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listSessions(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-email.md b/docs/examples/1.7.x/client-react-native/examples/account/update-email.md new file mode 100644 index 0000000000..4bbe0b03e7 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-email.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateEmail( + 'email@example.com', // email + 'password' // password +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-m-f-a.md b/docs/examples/1.7.x/client-react-native/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..ebbfc0c8cd --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-m-f-a.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMFA( + false // mfa +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/client-react-native/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..c5e6b61395 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMagicURLSession( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/client-react-native/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..07a798e7a6 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-mfa-authenticator.md @@ -0,0 +1,14 @@ +import { Client, Account, AuthenticatorType } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMfaAuthenticator( + AuthenticatorType.Totp, // type + '' // otp +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/client-react-native/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..b93e0bf520 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-mfa-challenge.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMfaChallenge( + '', // challengeId + '' // otp +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/client-react-native/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..2ed9bb0204 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMfaRecoveryCodes(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-name.md b/docs/examples/1.7.x/client-react-native/examples/account/update-name.md new file mode 100644 index 0000000000..adbbcab5be --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-name.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateName( + '' // name +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-password.md b/docs/examples/1.7.x/client-react-native/examples/account/update-password.md new file mode 100644 index 0000000000..3bde58e68a --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-password.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePassword( + '', // password + 'password' // oldPassword (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-phone-session.md b/docs/examples/1.7.x/client-react-native/examples/account/update-phone-session.md new file mode 100644 index 0000000000..c9c82696fc --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-phone-session.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePhoneSession( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-phone-verification.md b/docs/examples/1.7.x/client-react-native/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..0ef7e53e66 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-phone-verification.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePhoneVerification( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-phone.md b/docs/examples/1.7.x/client-react-native/examples/account/update-phone.md new file mode 100644 index 0000000000..bf8aae2a3d --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-phone.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePhone( + '+12065550100', // phone + 'password' // password +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-prefs.md b/docs/examples/1.7.x/client-react-native/examples/account/update-prefs.md new file mode 100644 index 0000000000..01d4fd6878 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-prefs.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePrefs( + {} // prefs +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-push-target.md b/docs/examples/1.7.x/client-react-native/examples/account/update-push-target.md new file mode 100644 index 0000000000..d88e22e04d --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-push-target.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePushTarget( + '', // targetId + '' // identifier +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-recovery.md b/docs/examples/1.7.x/client-react-native/examples/account/update-recovery.md new file mode 100644 index 0000000000..9a5ef04f3a --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-recovery.md @@ -0,0 +1,15 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateRecovery( + '', // userId + '', // secret + '' // password +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-session.md b/docs/examples/1.7.x/client-react-native/examples/account/update-session.md new file mode 100644 index 0000000000..0c8a9e5df3 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-session.md @@ -0,0 +1,13 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateSession( + '' // sessionId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-status.md b/docs/examples/1.7.x/client-react-native/examples/account/update-status.md new file mode 100644 index 0000000000..8d3a2b0698 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-status.md @@ -0,0 +1,11 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateStatus(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/account/update-verification.md b/docs/examples/1.7.x/client-react-native/examples/account/update-verification.md new file mode 100644 index 0000000000..c956d5fcd6 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/account/update-verification.md @@ -0,0 +1,14 @@ +import { Client, Account } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateVerification( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/avatars/get-browser.md b/docs/examples/1.7.x/client-react-native/examples/avatars/get-browser.md new file mode 100644 index 0000000000..433cbe5999 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/avatars/get-browser.md @@ -0,0 +1,16 @@ +import { Client, Avatars, Browser } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getBrowser( + Browser.AvantBrowser, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/client-react-native/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..bbd0007fe0 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/avatars/get-credit-card.md @@ -0,0 +1,16 @@ +import { Client, Avatars, CreditCard } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getCreditCard( + CreditCard.AmericanExpress, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/avatars/get-favicon.md b/docs/examples/1.7.x/client-react-native/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..ff48c76ffc --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/avatars/get-favicon.md @@ -0,0 +1,13 @@ +import { Client, Avatars } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getFavicon( + 'https://example.com' // url +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/avatars/get-flag.md b/docs/examples/1.7.x/client-react-native/examples/avatars/get-flag.md new file mode 100644 index 0000000000..4e6070d190 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/avatars/get-flag.md @@ -0,0 +1,16 @@ +import { Client, Avatars, Flag } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getFlag( + Flag.Afghanistan, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/avatars/get-image.md b/docs/examples/1.7.x/client-react-native/examples/avatars/get-image.md new file mode 100644 index 0000000000..006155effd --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/avatars/get-image.md @@ -0,0 +1,15 @@ +import { Client, Avatars } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getImage( + 'https://example.com', // url + 0, // width (optional) + 0 // height (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/avatars/get-initials.md b/docs/examples/1.7.x/client-react-native/examples/avatars/get-initials.md new file mode 100644 index 0000000000..a87a643450 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +import { Client, Avatars } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getInitials( + '', // name (optional) + 0, // width (optional) + 0, // height (optional) + '' // background (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/avatars/get-q-r.md b/docs/examples/1.7.x/client-react-native/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..177759d9ef --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/avatars/get-q-r.md @@ -0,0 +1,16 @@ +import { Client, Avatars } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getQR( + '', // text + 1, // size (optional) + 0, // margin (optional) + false // download (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/databases/create-document.md b/docs/examples/1.7.x/client-react-native/examples/databases/create-document.md new file mode 100644 index 0000000000..ec768fcfaf --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/databases/create-document.md @@ -0,0 +1,19 @@ +import { Client, Databases } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setKey('') // + .setJWT(''); // Your secret JSON Web Token + +const databases = new Databases(client); + +const result = await databases.createDocument( + '', // databaseId + '', // collectionId + '', // documentId + {}, // data + ["read("any")"] // permissions (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/databases/delete-document.md b/docs/examples/1.7.x/client-react-native/examples/databases/delete-document.md new file mode 100644 index 0000000000..9136107a3c --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/databases/delete-document.md @@ -0,0 +1,15 @@ +import { Client, Databases } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.deleteDocument( + '', // databaseId + '', // collectionId + '' // documentId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/databases/get-document.md b/docs/examples/1.7.x/client-react-native/examples/databases/get-document.md new file mode 100644 index 0000000000..9993e2c941 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/databases/get-document.md @@ -0,0 +1,16 @@ +import { Client, Databases } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.getDocument( + '', // databaseId + '', // collectionId + '', // documentId + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/databases/list-documents.md b/docs/examples/1.7.x/client-react-native/examples/databases/list-documents.md new file mode 100644 index 0000000000..b2f377e53c --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/databases/list-documents.md @@ -0,0 +1,15 @@ +import { Client, Databases } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.listDocuments( + '', // databaseId + '', // collectionId + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/databases/update-document.md b/docs/examples/1.7.x/client-react-native/examples/databases/update-document.md new file mode 100644 index 0000000000..7676ee109b --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/databases/update-document.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateDocument( + '', // databaseId + '', // collectionId + '', // documentId + {}, // data (optional) + ["read("any")"] // permissions (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/functions/create-execution.md b/docs/examples/1.7.x/client-react-native/examples/functions/create-execution.md new file mode 100644 index 0000000000..72c71f7767 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/functions/create-execution.md @@ -0,0 +1,19 @@ +import { Client, Functions, ExecutionMethod } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.createExecution( + '', // functionId + '', // body (optional) + false, // async (optional) + '', // path (optional) + ExecutionMethod.GET, // method (optional) + {}, // headers (optional) + '' // scheduledAt (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/functions/get-execution.md b/docs/examples/1.7.x/client-react-native/examples/functions/get-execution.md new file mode 100644 index 0000000000..848747ea2f --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/functions/get-execution.md @@ -0,0 +1,14 @@ +import { Client, Functions } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.getExecution( + '', // functionId + '' // executionId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/functions/list-executions.md b/docs/examples/1.7.x/client-react-native/examples/functions/list-executions.md new file mode 100644 index 0000000000..346f8c7ea8 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/functions/list-executions.md @@ -0,0 +1,14 @@ +import { Client, Functions } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.listExecutions( + '', // functionId + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/graphql/mutation.md b/docs/examples/1.7.x/client-react-native/examples/graphql/mutation.md new file mode 100644 index 0000000000..3292a5dad2 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/graphql/mutation.md @@ -0,0 +1,13 @@ +import { Client, Graphql } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const graphql = new Graphql(client); + +const result = await graphql.mutation( + {} // query +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/graphql/query.md b/docs/examples/1.7.x/client-react-native/examples/graphql/query.md new file mode 100644 index 0000000000..a00c517a46 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/graphql/query.md @@ -0,0 +1,13 @@ +import { Client, Graphql } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const graphql = new Graphql(client); + +const result = await graphql.query( + {} // query +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/locale/get.md b/docs/examples/1.7.x/client-react-native/examples/locale/get.md new file mode 100644 index 0000000000..34c1672c53 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/locale/get.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.get(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/locale/list-codes.md b/docs/examples/1.7.x/client-react-native/examples/locale/list-codes.md new file mode 100644 index 0000000000..29cec5a5cf --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/locale/list-codes.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCodes(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/locale/list-continents.md b/docs/examples/1.7.x/client-react-native/examples/locale/list-continents.md new file mode 100644 index 0000000000..c98ba19af3 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/locale/list-continents.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listContinents(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/client-react-native/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..7fb71a548d --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/locale/list-countries-e-u.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCountriesEU(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/client-react-native/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..612debc5ab --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/locale/list-countries-phones.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCountriesPhones(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/locale/list-countries.md b/docs/examples/1.7.x/client-react-native/examples/locale/list-countries.md new file mode 100644 index 0000000000..8b1f636fa6 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/locale/list-countries.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCountries(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/locale/list-currencies.md b/docs/examples/1.7.x/client-react-native/examples/locale/list-currencies.md new file mode 100644 index 0000000000..4b96a5fdbc --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/locale/list-currencies.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCurrencies(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/locale/list-languages.md b/docs/examples/1.7.x/client-react-native/examples/locale/list-languages.md new file mode 100644 index 0000000000..54166afb1e --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/locale/list-languages.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listLanguages(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/client-react-native/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..c950e90bae --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/messaging/create-subscriber.md @@ -0,0 +1,15 @@ +import { Client, Messaging } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createSubscriber( + '', // topicId + '', // subscriberId + '' // targetId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/client-react-native/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..5004b59cac --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/messaging/delete-subscriber.md @@ -0,0 +1,14 @@ +import { Client, Messaging } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.deleteSubscriber( + '', // topicId + '' // subscriberId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/storage/create-file.md b/docs/examples/1.7.x/client-react-native/examples/storage/create-file.md new file mode 100644 index 0000000000..efbfd607c1 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/storage/create-file.md @@ -0,0 +1,16 @@ +import { Client, Storage } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.createFile( + '', // bucketId + '', // fileId + await pickSingle(), // file + ["read("any")"] // permissions (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/storage/delete-file.md b/docs/examples/1.7.x/client-react-native/examples/storage/delete-file.md new file mode 100644 index 0000000000..1a436ac8a8 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/storage/delete-file.md @@ -0,0 +1,14 @@ +import { Client, Storage } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.deleteFile( + '', // bucketId + '' // fileId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/storage/get-file-download.md b/docs/examples/1.7.x/client-react-native/examples/storage/get-file-download.md new file mode 100644 index 0000000000..e21bad67eb --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/storage/get-file-download.md @@ -0,0 +1,15 @@ +import { Client, Storage } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = storage.getFileDownload( + '', // bucketId + '', // fileId + '' // token (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/storage/get-file-preview.md b/docs/examples/1.7.x/client-react-native/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..6f116c5df6 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/storage/get-file-preview.md @@ -0,0 +1,26 @@ +import { Client, Storage, ImageGravity, ImageFormat } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = storage.getFilePreview( + '', // bucketId + '', // fileId + 0, // width (optional) + 0, // height (optional) + ImageGravity.Center, // gravity (optional) + -1, // quality (optional) + 0, // borderWidth (optional) + '', // borderColor (optional) + 0, // borderRadius (optional) + 0, // opacity (optional) + -360, // rotation (optional) + '', // background (optional) + ImageFormat.Jpg, // output (optional) + '' // token (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/storage/get-file-view.md b/docs/examples/1.7.x/client-react-native/examples/storage/get-file-view.md new file mode 100644 index 0000000000..9b229f6a54 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/storage/get-file-view.md @@ -0,0 +1,15 @@ +import { Client, Storage } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = storage.getFileView( + '', // bucketId + '', // fileId + '' // token (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/storage/get-file.md b/docs/examples/1.7.x/client-react-native/examples/storage/get-file.md new file mode 100644 index 0000000000..6d358adabd --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/storage/get-file.md @@ -0,0 +1,14 @@ +import { Client, Storage } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.getFile( + '', // bucketId + '' // fileId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/storage/list-files.md b/docs/examples/1.7.x/client-react-native/examples/storage/list-files.md new file mode 100644 index 0000000000..19099b1288 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/storage/list-files.md @@ -0,0 +1,15 @@ +import { Client, Storage } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.listFiles( + '', // bucketId + [], // queries (optional) + '' // search (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/storage/update-file.md b/docs/examples/1.7.x/client-react-native/examples/storage/update-file.md new file mode 100644 index 0000000000..d4ed68a337 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/storage/update-file.md @@ -0,0 +1,16 @@ +import { Client, Storage } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.updateFile( + '', // bucketId + '', // fileId + '', // name (optional) + ["read("any")"] // permissions (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/create-membership.md b/docs/examples/1.7.x/client-react-native/examples/teams/create-membership.md new file mode 100644 index 0000000000..680fdb2ad8 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/create-membership.md @@ -0,0 +1,19 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.createMembership( + '', // teamId + [], // roles + 'email@example.com', // email (optional) + '', // userId (optional) + '+12065550100', // phone (optional) + 'https://example.com', // url (optional) + '' // name (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/create.md b/docs/examples/1.7.x/client-react-native/examples/teams/create.md new file mode 100644 index 0000000000..51aaee358e --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/create.md @@ -0,0 +1,15 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.create( + '', // teamId + '', // name + [] // roles (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/delete-membership.md b/docs/examples/1.7.x/client-react-native/examples/teams/delete-membership.md new file mode 100644 index 0000000000..37bdc7f87f --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/delete-membership.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.deleteMembership( + '', // teamId + '' // membershipId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/delete.md b/docs/examples/1.7.x/client-react-native/examples/teams/delete.md new file mode 100644 index 0000000000..fe67eaffd1 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/delete.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.delete( + '' // teamId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/get-membership.md b/docs/examples/1.7.x/client-react-native/examples/teams/get-membership.md new file mode 100644 index 0000000000..2b253c8b51 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/get-membership.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.getMembership( + '', // teamId + '' // membershipId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/get-prefs.md b/docs/examples/1.7.x/client-react-native/examples/teams/get-prefs.md new file mode 100644 index 0000000000..943ed1a181 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/get-prefs.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.getPrefs( + '' // teamId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/get.md b/docs/examples/1.7.x/client-react-native/examples/teams/get.md new file mode 100644 index 0000000000..9267b57e2f --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/get.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.get( + '' // teamId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/list-memberships.md b/docs/examples/1.7.x/client-react-native/examples/teams/list-memberships.md new file mode 100644 index 0000000000..4444bcd664 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/list-memberships.md @@ -0,0 +1,15 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.listMemberships( + '', // teamId + [], // queries (optional) + '' // search (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/list.md b/docs/examples/1.7.x/client-react-native/examples/teams/list.md new file mode 100644 index 0000000000..779538a70a --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/list.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.list( + [], // queries (optional) + '' // search (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/update-membership-status.md b/docs/examples/1.7.x/client-react-native/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..c8edbf08c7 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/update-membership-status.md @@ -0,0 +1,16 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.updateMembershipStatus( + '', // teamId + '', // membershipId + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/update-membership.md b/docs/examples/1.7.x/client-react-native/examples/teams/update-membership.md new file mode 100644 index 0000000000..347cbdd095 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/update-membership.md @@ -0,0 +1,15 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.updateMembership( + '', // teamId + '', // membershipId + [] // roles +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/update-name.md b/docs/examples/1.7.x/client-react-native/examples/teams/update-name.md new file mode 100644 index 0000000000..0ab4aa1c84 --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/update-name.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.updateName( + '', // teamId + '' // name +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-react-native/examples/teams/update-prefs.md b/docs/examples/1.7.x/client-react-native/examples/teams/update-prefs.md new file mode 100644 index 0000000000..fda16a05db --- /dev/null +++ b/docs/examples/1.7.x/client-react-native/examples/teams/update-prefs.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "react-native-appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.updatePrefs( + '', // teamId + {} // prefs +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/client-rest/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..2079b045d1 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-anonymous-session.md @@ -0,0 +1,6 @@ +POST /v1/account/sessions/anonymous HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-email-password-session.md b/docs/examples/1.7.x/client-rest/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..8aee0e5b15 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-email-password-session.md @@ -0,0 +1,10 @@ +POST /v1/account/sessions/email HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + +{ + "email": "email@example.com", + "password": "password" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-email-token.md b/docs/examples/1.7.x/client-rest/examples/account/create-email-token.md new file mode 100644 index 0000000000..98c5c9b454 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-email-token.md @@ -0,0 +1,11 @@ +POST /v1/account/tokens/email HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + +{ + "userId": "", + "email": "email@example.com", + "phrase": false +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-j-w-t.md b/docs/examples/1.7.x/client-rest/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..a8da4695c3 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-j-w-t.md @@ -0,0 +1,6 @@ +POST /v1/account/jwts HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/client-rest/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..a3db43516a --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,12 @@ +POST /v1/account/tokens/magic-url HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + +{ + "userId": "", + "email": "email@example.com", + "url": "https://example.com", + "phrase": false +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/client-rest/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..8d6b52b877 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-mfa-authenticator.md @@ -0,0 +1,8 @@ +POST /v1/account/mfa/authenticators/{type} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/client-rest/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..9a84c0ef69 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-mfa-challenge.md @@ -0,0 +1,9 @@ +POST /v1/account/mfa/challenge HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + +{ + "factor": "email" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/client-rest/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..797824d5d7 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,8 @@ +POST /v1/account/mfa/recovery-codes HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-o-auth2session.md b/docs/examples/1.7.x/client-rest/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..293170b490 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-o-auth2session.md @@ -0,0 +1,4 @@ +GET /v1/account/sessions/oauth2/{provider} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/client-rest/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..dd1dd3ec5e --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-o-auth2token.md @@ -0,0 +1,4 @@ +GET /v1/account/tokens/oauth2/{provider} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-phone-token.md b/docs/examples/1.7.x/client-rest/examples/account/create-phone-token.md new file mode 100644 index 0000000000..eef1021d9e --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-phone-token.md @@ -0,0 +1,10 @@ +POST /v1/account/tokens/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + +{ + "userId": "", + "phone": "+12065550100" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-phone-verification.md b/docs/examples/1.7.x/client-rest/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..d161e580ff --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-phone-verification.md @@ -0,0 +1,8 @@ +POST /v1/account/verification/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-push-target.md b/docs/examples/1.7.x/client-rest/examples/account/create-push-target.md new file mode 100644 index 0000000000..5844ccc19e --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-push-target.md @@ -0,0 +1,12 @@ +POST /v1/account/targets/push HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: + +{ + "targetId": "", + "identifier": "", + "providerId": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-recovery.md b/docs/examples/1.7.x/client-rest/examples/account/create-recovery.md new file mode 100644 index 0000000000..c195b96a5e --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-recovery.md @@ -0,0 +1,12 @@ +POST /v1/account/recovery HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "email": "email@example.com", + "url": "https://example.com" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-session.md b/docs/examples/1.7.x/client-rest/examples/account/create-session.md new file mode 100644 index 0000000000..18e3b1acdd --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-session.md @@ -0,0 +1,10 @@ +POST /v1/account/sessions/token HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + +{ + "userId": "", + "secret": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/create-verification.md b/docs/examples/1.7.x/client-rest/examples/account/create-verification.md new file mode 100644 index 0000000000..1185d3a875 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create-verification.md @@ -0,0 +1,11 @@ +POST /v1/account/verification HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "url": "https://example.com" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/create.md b/docs/examples/1.7.x/client-rest/examples/account/create.md new file mode 100644 index 0000000000..f546c07de5 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/create.md @@ -0,0 +1,12 @@ +POST /v1/account HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + +{ + "userId": "", + "email": "email@example.com", + "password": , + "name": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/delete-identity.md b/docs/examples/1.7.x/client-rest/examples/account/delete-identity.md new file mode 100644 index 0000000000..edb036a593 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/delete-identity.md @@ -0,0 +1,8 @@ +DELETE /v1/account/identities/{identityId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/client-rest/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..de58948195 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,8 @@ +DELETE /v1/account/mfa/authenticators/{type} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/delete-push-target.md b/docs/examples/1.7.x/client-rest/examples/account/delete-push-target.md new file mode 100644 index 0000000000..fdfc75a41b --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/delete-push-target.md @@ -0,0 +1,7 @@ +DELETE /v1/account/targets/{targetId}/push HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/delete-session.md b/docs/examples/1.7.x/client-rest/examples/account/delete-session.md new file mode 100644 index 0000000000..9454a84913 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/delete-session.md @@ -0,0 +1,8 @@ +DELETE /v1/account/sessions/{sessionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/delete-sessions.md b/docs/examples/1.7.x/client-rest/examples/account/delete-sessions.md new file mode 100644 index 0000000000..97931c12e5 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/delete-sessions.md @@ -0,0 +1,8 @@ +DELETE /v1/account/sessions HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/client-rest/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..81edee5234 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,6 @@ +GET /v1/account/mfa/recovery-codes HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/account/get-prefs.md b/docs/examples/1.7.x/client-rest/examples/account/get-prefs.md new file mode 100644 index 0000000000..13a0b74d8f --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/get-prefs.md @@ -0,0 +1,6 @@ +GET /v1/account/prefs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/account/get-session.md b/docs/examples/1.7.x/client-rest/examples/account/get-session.md new file mode 100644 index 0000000000..9417755b04 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/get-session.md @@ -0,0 +1,6 @@ +GET /v1/account/sessions/{sessionId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/account/get.md b/docs/examples/1.7.x/client-rest/examples/account/get.md new file mode 100644 index 0000000000..023a6d116f --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/get.md @@ -0,0 +1,6 @@ +GET /v1/account HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/account/list-identities.md b/docs/examples/1.7.x/client-rest/examples/account/list-identities.md new file mode 100644 index 0000000000..65edceb8d6 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/list-identities.md @@ -0,0 +1,6 @@ +GET /v1/account/identities HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/account/list-logs.md b/docs/examples/1.7.x/client-rest/examples/account/list-logs.md new file mode 100644 index 0000000000..71e2e138ef --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/list-logs.md @@ -0,0 +1,6 @@ +GET /v1/account/logs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/client-rest/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..217ec6cb30 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/list-mfa-factors.md @@ -0,0 +1,6 @@ +GET /v1/account/mfa/factors HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/account/list-sessions.md b/docs/examples/1.7.x/client-rest/examples/account/list-sessions.md new file mode 100644 index 0000000000..7bff23f25b --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/list-sessions.md @@ -0,0 +1,6 @@ +GET /v1/account/sessions HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-email.md b/docs/examples/1.7.x/client-rest/examples/account/update-email.md new file mode 100644 index 0000000000..fc3baaf4a4 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-email.md @@ -0,0 +1,12 @@ +PATCH /v1/account/email HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "email": "email@example.com", + "password": "password" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-m-f-a.md b/docs/examples/1.7.x/client-rest/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..803c47a857 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-m-f-a.md @@ -0,0 +1,11 @@ +PATCH /v1/account/mfa HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "mfa": false +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/client-rest/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..3238322e0f --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,10 @@ +PUT /v1/account/sessions/magic-url HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + +{ + "userId": "", + "secret": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/client-rest/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..9d3e5dceea --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-mfa-authenticator.md @@ -0,0 +1,11 @@ +PUT /v1/account/mfa/authenticators/{type} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "otp": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/client-rest/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..ddc27ae334 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-mfa-challenge.md @@ -0,0 +1,12 @@ +PUT /v1/account/mfa/challenge HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "challengeId": "", + "otp": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/client-rest/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..e4ab8abb3b --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,8 @@ +PATCH /v1/account/mfa/recovery-codes HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-name.md b/docs/examples/1.7.x/client-rest/examples/account/update-name.md new file mode 100644 index 0000000000..f2f7caa204 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-name.md @@ -0,0 +1,11 @@ +PATCH /v1/account/name HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "name": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-password.md b/docs/examples/1.7.x/client-rest/examples/account/update-password.md new file mode 100644 index 0000000000..4f69b9ab3f --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-password.md @@ -0,0 +1,12 @@ +PATCH /v1/account/password HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "password": , + "oldPassword": "password" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-phone-session.md b/docs/examples/1.7.x/client-rest/examples/account/update-phone-session.md new file mode 100644 index 0000000000..f1bc27d201 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-phone-session.md @@ -0,0 +1,10 @@ +PUT /v1/account/sessions/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: + +{ + "userId": "", + "secret": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-phone-verification.md b/docs/examples/1.7.x/client-rest/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..ee6f5a68ff --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-phone-verification.md @@ -0,0 +1,12 @@ +PUT /v1/account/verification/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "userId": "", + "secret": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-phone.md b/docs/examples/1.7.x/client-rest/examples/account/update-phone.md new file mode 100644 index 0000000000..bbe602a181 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-phone.md @@ -0,0 +1,12 @@ +PATCH /v1/account/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "phone": "+12065550100", + "password": "password" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-prefs.md b/docs/examples/1.7.x/client-rest/examples/account/update-prefs.md new file mode 100644 index 0000000000..aeabc2b68f --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-prefs.md @@ -0,0 +1,11 @@ +PATCH /v1/account/prefs HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "prefs": {} +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-push-target.md b/docs/examples/1.7.x/client-rest/examples/account/update-push-target.md new file mode 100644 index 0000000000..2e42a2d67f --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-push-target.md @@ -0,0 +1,10 @@ +PUT /v1/account/targets/{targetId}/push HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: + +{ + "identifier": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-recovery.md b/docs/examples/1.7.x/client-rest/examples/account/update-recovery.md new file mode 100644 index 0000000000..054aacc8ed --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-recovery.md @@ -0,0 +1,13 @@ +PUT /v1/account/recovery HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "userId": "", + "secret": "", + "password": +} diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-session.md b/docs/examples/1.7.x/client-rest/examples/account/update-session.md new file mode 100644 index 0000000000..9b2ba0e4a7 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-session.md @@ -0,0 +1,8 @@ +PATCH /v1/account/sessions/{sessionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-status.md b/docs/examples/1.7.x/client-rest/examples/account/update-status.md new file mode 100644 index 0000000000..8a3e01db0b --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-status.md @@ -0,0 +1,8 @@ +PATCH /v1/account/status HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/account/update-verification.md b/docs/examples/1.7.x/client-rest/examples/account/update-verification.md new file mode 100644 index 0000000000..0c5ed8b55d --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/account/update-verification.md @@ -0,0 +1,12 @@ +PUT /v1/account/verification HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "userId": "", + "secret": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/avatars/get-browser.md b/docs/examples/1.7.x/client-rest/examples/avatars/get-browser.md new file mode 100644 index 0000000000..e5f6f22ab5 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/avatars/get-browser.md @@ -0,0 +1,6 @@ +GET /v1/avatars/browsers/{code} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/client-rest/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..ab513115f8 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/avatars/get-credit-card.md @@ -0,0 +1,6 @@ +GET /v1/avatars/credit-cards/{code} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/avatars/get-favicon.md b/docs/examples/1.7.x/client-rest/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..837dba633c --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/avatars/get-favicon.md @@ -0,0 +1,6 @@ +GET /v1/avatars/favicon HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/avatars/get-flag.md b/docs/examples/1.7.x/client-rest/examples/avatars/get-flag.md new file mode 100644 index 0000000000..d0c92d7c02 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/avatars/get-flag.md @@ -0,0 +1,6 @@ +GET /v1/avatars/flags/{code} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/avatars/get-image.md b/docs/examples/1.7.x/client-rest/examples/avatars/get-image.md new file mode 100644 index 0000000000..2f80018f20 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/avatars/get-image.md @@ -0,0 +1,6 @@ +GET /v1/avatars/image HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/avatars/get-initials.md b/docs/examples/1.7.x/client-rest/examples/avatars/get-initials.md new file mode 100644 index 0000000000..f3879b5d52 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/avatars/get-initials.md @@ -0,0 +1,6 @@ +GET /v1/avatars/initials HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/avatars/get-q-r.md b/docs/examples/1.7.x/client-rest/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..263c54742c --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/avatars/get-q-r.md @@ -0,0 +1,6 @@ +GET /v1/avatars/qr HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/databases/create-document.md b/docs/examples/1.7.x/client-rest/examples/databases/create-document.md new file mode 100644 index 0000000000..3126197555 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/databases/create-document.md @@ -0,0 +1,13 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "documentId": "", + "data": {}, + "permissions": ["read(\"any\")"] +} diff --git a/docs/examples/1.7.x/client-rest/examples/databases/delete-document.md b/docs/examples/1.7.x/client-rest/examples/databases/delete-document.md new file mode 100644 index 0000000000..6b86aba853 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/databases/delete-document.md @@ -0,0 +1,8 @@ +DELETE /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/databases/get-document.md b/docs/examples/1.7.x/client-rest/examples/databases/get-document.md new file mode 100644 index 0000000000..a32db40087 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/databases/get-document.md @@ -0,0 +1,6 @@ +GET /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/databases/list-documents.md b/docs/examples/1.7.x/client-rest/examples/databases/list-documents.md new file mode 100644 index 0000000000..22ca529e89 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/databases/list-documents.md @@ -0,0 +1,6 @@ +GET /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/databases/update-document.md b/docs/examples/1.7.x/client-rest/examples/databases/update-document.md new file mode 100644 index 0000000000..945b957c6e --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/databases/update-document.md @@ -0,0 +1,12 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "data": {}, + "permissions": ["read(\"any\")"] +} diff --git a/docs/examples/1.7.x/client-rest/examples/functions/create-execution.md b/docs/examples/1.7.x/client-rest/examples/functions/create-execution.md new file mode 100644 index 0000000000..fec92ddab0 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/functions/create-execution.md @@ -0,0 +1,16 @@ +POST /v1/functions/{functionId}/executions HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "body": "", + "async": false, + "path": "", + "method": "GET", + "headers": {}, + "scheduledAt": +} diff --git a/docs/examples/1.7.x/client-rest/examples/functions/get-execution.md b/docs/examples/1.7.x/client-rest/examples/functions/get-execution.md new file mode 100644 index 0000000000..7df2f3acbe --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/functions/get-execution.md @@ -0,0 +1,6 @@ +GET /v1/functions/{functionId}/executions/{executionId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/functions/list-executions.md b/docs/examples/1.7.x/client-rest/examples/functions/list-executions.md new file mode 100644 index 0000000000..b2ab0e05d1 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/functions/list-executions.md @@ -0,0 +1,6 @@ +GET /v1/functions/{functionId}/executions HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/graphql/mutation.md b/docs/examples/1.7.x/client-rest/examples/graphql/mutation.md new file mode 100644 index 0000000000..db3b1c0c78 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/graphql/mutation.md @@ -0,0 +1,12 @@ +POST /v1/graphql/mutation HTTP/1.1 +Host: cloud.appwrite.io +X-Sdk-Graphql: true +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "query": {} +} diff --git a/docs/examples/1.7.x/client-rest/examples/graphql/query.md b/docs/examples/1.7.x/client-rest/examples/graphql/query.md new file mode 100644 index 0000000000..8fc41efcfe --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/graphql/query.md @@ -0,0 +1,12 @@ +POST /v1/graphql HTTP/1.1 +Host: cloud.appwrite.io +X-Sdk-Graphql: true +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "query": {} +} diff --git a/docs/examples/1.7.x/client-rest/examples/locale/get.md b/docs/examples/1.7.x/client-rest/examples/locale/get.md new file mode 100644 index 0000000000..0d67644583 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/locale/get.md @@ -0,0 +1,6 @@ +GET /v1/locale HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/locale/list-codes.md b/docs/examples/1.7.x/client-rest/examples/locale/list-codes.md new file mode 100644 index 0000000000..f362c5987e --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/locale/list-codes.md @@ -0,0 +1,6 @@ +GET /v1/locale/codes HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/locale/list-continents.md b/docs/examples/1.7.x/client-rest/examples/locale/list-continents.md new file mode 100644 index 0000000000..93db4fb302 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/locale/list-continents.md @@ -0,0 +1,6 @@ +GET /v1/locale/continents HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/client-rest/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..09eba6168f --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/locale/list-countries-e-u.md @@ -0,0 +1,6 @@ +GET /v1/locale/countries/eu HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/client-rest/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..94ef0bb943 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/locale/list-countries-phones.md @@ -0,0 +1,6 @@ +GET /v1/locale/countries/phones HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/locale/list-countries.md b/docs/examples/1.7.x/client-rest/examples/locale/list-countries.md new file mode 100644 index 0000000000..dc8289980a --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/locale/list-countries.md @@ -0,0 +1,6 @@ +GET /v1/locale/countries HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/locale/list-currencies.md b/docs/examples/1.7.x/client-rest/examples/locale/list-currencies.md new file mode 100644 index 0000000000..9a3af20c94 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/locale/list-currencies.md @@ -0,0 +1,6 @@ +GET /v1/locale/currencies HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/locale/list-languages.md b/docs/examples/1.7.x/client-rest/examples/locale/list-languages.md new file mode 100644 index 0000000000..7d90c8b40a --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/locale/list-languages.md @@ -0,0 +1,6 @@ +GET /v1/locale/languages HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/client-rest/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..94e98c4438 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/messaging/create-subscriber.md @@ -0,0 +1,12 @@ +POST /v1/messaging/topics/{topicId}/subscribers HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-JWT: +X-Appwrite-Session: + +{ + "subscriberId": "", + "targetId": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/client-rest/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..e5ac0830a3 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/messaging/delete-subscriber.md @@ -0,0 +1,8 @@ +DELETE /v1/messaging/topics/{topicId}/subscribers/{subscriberId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-JWT: +X-Appwrite-Session: + diff --git a/docs/examples/1.7.x/client-rest/examples/storage/create-file.md b/docs/examples/1.7.x/client-rest/examples/storage/create-file.md new file mode 100644 index 0000000000..f044b577b2 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/storage/create-file.md @@ -0,0 +1,26 @@ +POST /v1/storage/buckets/{bucketId}/files HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: +Content-Length: *Length of your entity body in bytes* + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="fileId" + +"" + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="file" + +cf 94 84 24 8d c4 91 10 0f dc 54 26 6c 8e 4b bc +e8 ee 55 94 29 e7 94 89 19 26 28 01 26 29 3f 16... + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="permissions[]" + +["read(\"any\")"] + +--cec8e8123c05ba25-- diff --git a/docs/examples/1.7.x/client-rest/examples/storage/delete-file.md b/docs/examples/1.7.x/client-rest/examples/storage/delete-file.md new file mode 100644 index 0000000000..8d074341fe --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/storage/delete-file.md @@ -0,0 +1,8 @@ +DELETE /v1/storage/buckets/{bucketId}/files/{fileId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/storage/get-file-download.md b/docs/examples/1.7.x/client-rest/examples/storage/get-file-download.md new file mode 100644 index 0000000000..58c9c6d276 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/storage/get-file-download.md @@ -0,0 +1,6 @@ +GET /v1/storage/buckets/{bucketId}/files/{fileId}/download HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/storage/get-file-preview.md b/docs/examples/1.7.x/client-rest/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..ff24de4ec4 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/storage/get-file-preview.md @@ -0,0 +1,6 @@ +GET /v1/storage/buckets/{bucketId}/files/{fileId}/preview HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/storage/get-file-view.md b/docs/examples/1.7.x/client-rest/examples/storage/get-file-view.md new file mode 100644 index 0000000000..9c95a2b48f --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/storage/get-file-view.md @@ -0,0 +1,6 @@ +GET /v1/storage/buckets/{bucketId}/files/{fileId}/view HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/storage/get-file.md b/docs/examples/1.7.x/client-rest/examples/storage/get-file.md new file mode 100644 index 0000000000..ffb3703fe1 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/storage/get-file.md @@ -0,0 +1,6 @@ +GET /v1/storage/buckets/{bucketId}/files/{fileId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/storage/list-files.md b/docs/examples/1.7.x/client-rest/examples/storage/list-files.md new file mode 100644 index 0000000000..d1258b97de --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/storage/list-files.md @@ -0,0 +1,6 @@ +GET /v1/storage/buckets/{bucketId}/files HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/storage/update-file.md b/docs/examples/1.7.x/client-rest/examples/storage/update-file.md new file mode 100644 index 0000000000..210433622b --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/storage/update-file.md @@ -0,0 +1,12 @@ +PUT /v1/storage/buckets/{bucketId}/files/{fileId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "name": "", + "permissions": ["read(\"any\")"] +} diff --git a/docs/examples/1.7.x/client-rest/examples/teams/create-membership.md b/docs/examples/1.7.x/client-rest/examples/teams/create-membership.md new file mode 100644 index 0000000000..83e4803502 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/create-membership.md @@ -0,0 +1,16 @@ +POST /v1/teams/{teamId}/memberships HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "email": "email@example.com", + "userId": "", + "phone": "+12065550100", + "roles": [], + "url": "https://example.com", + "name": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/teams/create.md b/docs/examples/1.7.x/client-rest/examples/teams/create.md new file mode 100644 index 0000000000..c80b2bda8e --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/create.md @@ -0,0 +1,13 @@ +POST /v1/teams HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "teamId": "", + "name": "", + "roles": [] +} diff --git a/docs/examples/1.7.x/client-rest/examples/teams/delete-membership.md b/docs/examples/1.7.x/client-rest/examples/teams/delete-membership.md new file mode 100644 index 0000000000..0fc17e11ee --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/delete-membership.md @@ -0,0 +1,8 @@ +DELETE /v1/teams/{teamId}/memberships/{membershipId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/teams/delete.md b/docs/examples/1.7.x/client-rest/examples/teams/delete.md new file mode 100644 index 0000000000..ad614b17d1 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/delete.md @@ -0,0 +1,8 @@ +DELETE /v1/teams/{teamId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + diff --git a/docs/examples/1.7.x/client-rest/examples/teams/get-membership.md b/docs/examples/1.7.x/client-rest/examples/teams/get-membership.md new file mode 100644 index 0000000000..dbe034f34b --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/get-membership.md @@ -0,0 +1,6 @@ +GET /v1/teams/{teamId}/memberships/{membershipId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/teams/get-prefs.md b/docs/examples/1.7.x/client-rest/examples/teams/get-prefs.md new file mode 100644 index 0000000000..ddb863181d --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/get-prefs.md @@ -0,0 +1,6 @@ +GET /v1/teams/{teamId}/prefs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/teams/get.md b/docs/examples/1.7.x/client-rest/examples/teams/get.md new file mode 100644 index 0000000000..730d23a03b --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/get.md @@ -0,0 +1,6 @@ +GET /v1/teams/{teamId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/teams/list-memberships.md b/docs/examples/1.7.x/client-rest/examples/teams/list-memberships.md new file mode 100644 index 0000000000..82a9f82c33 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/list-memberships.md @@ -0,0 +1,6 @@ +GET /v1/teams/{teamId}/memberships HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/teams/list.md b/docs/examples/1.7.x/client-rest/examples/teams/list.md new file mode 100644 index 0000000000..00a419269a --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/list.md @@ -0,0 +1,6 @@ +GET /v1/teams HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: diff --git a/docs/examples/1.7.x/client-rest/examples/teams/update-membership-status.md b/docs/examples/1.7.x/client-rest/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..9d828118f0 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/update-membership-status.md @@ -0,0 +1,12 @@ +PATCH /v1/teams/{teamId}/memberships/{membershipId}/status HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "userId": "", + "secret": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/teams/update-membership.md b/docs/examples/1.7.x/client-rest/examples/teams/update-membership.md new file mode 100644 index 0000000000..3768499d16 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/update-membership.md @@ -0,0 +1,11 @@ +PATCH /v1/teams/{teamId}/memberships/{membershipId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "roles": [] +} diff --git a/docs/examples/1.7.x/client-rest/examples/teams/update-name.md b/docs/examples/1.7.x/client-rest/examples/teams/update-name.md new file mode 100644 index 0000000000..ec381348e8 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/update-name.md @@ -0,0 +1,11 @@ +PUT /v1/teams/{teamId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "name": "" +} diff --git a/docs/examples/1.7.x/client-rest/examples/teams/update-prefs.md b/docs/examples/1.7.x/client-rest/examples/teams/update-prefs.md new file mode 100644 index 0000000000..1db6300350 --- /dev/null +++ b/docs/examples/1.7.x/client-rest/examples/teams/update-prefs.md @@ -0,0 +1,11 @@ +PUT /v1/teams/{teamId}/prefs HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: +X-Appwrite-Session: +X-Appwrite-JWT: + +{ + "prefs": {} +} diff --git a/docs/examples/1.7.x/client-web/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/client-web/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..42279c0312 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-anonymous-session.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createAnonymousSession(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-email-password-session.md b/docs/examples/1.7.x/client-web/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..3438ffbe54 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-email-password-session.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createEmailPasswordSession( + 'email@example.com', // email + 'password' // password +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-email-token.md b/docs/examples/1.7.x/client-web/examples/account/create-email-token.md new file mode 100644 index 0000000000..e7cab7c360 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-email-token.md @@ -0,0 +1,15 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createEmailToken( + '', // userId + 'email@example.com', // email + false // phrase (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-j-w-t.md b/docs/examples/1.7.x/client-web/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..ff17d60661 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-j-w-t.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createJWT(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/client-web/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..ba87bd9a3f --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,16 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createMagicURLToken( + '', // userId + 'email@example.com', // email + 'https://example.com', // url (optional) + false // phrase (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/client-web/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..510481511d --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-mfa-authenticator.md @@ -0,0 +1,13 @@ +import { Client, Account, AuthenticatorType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createMfaAuthenticator( + AuthenticatorType.Totp // type +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/client-web/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..e9f6f08b48 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-mfa-challenge.md @@ -0,0 +1,13 @@ +import { Client, Account, AuthenticationFactor } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createMfaChallenge( + AuthenticationFactor.Email // factor +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/client-web/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..2cc744175e --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createMfaRecoveryCodes(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-o-auth2session.md b/docs/examples/1.7.x/client-web/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..caad309ffd --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-o-auth2session.md @@ -0,0 +1,15 @@ +import { Client, Account, OAuthProvider } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +account.createOAuth2Session( + OAuthProvider.Amazon, // provider + 'https://example.com', // success (optional) + 'https://example.com', // failure (optional) + [] // scopes (optional) +); + diff --git a/docs/examples/1.7.x/client-web/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/client-web/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..5f0aab36d8 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-o-auth2token.md @@ -0,0 +1,15 @@ +import { Client, Account, OAuthProvider } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +account.createOAuth2Token( + OAuthProvider.Amazon, // provider + 'https://example.com', // success (optional) + 'https://example.com', // failure (optional) + [] // scopes (optional) +); + diff --git a/docs/examples/1.7.x/client-web/examples/account/create-phone-token.md b/docs/examples/1.7.x/client-web/examples/account/create-phone-token.md new file mode 100644 index 0000000000..481e57d353 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-phone-token.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createPhoneToken( + '', // userId + '+12065550100' // phone +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-phone-verification.md b/docs/examples/1.7.x/client-web/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..00373a3dd4 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-phone-verification.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createPhoneVerification(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-push-target.md b/docs/examples/1.7.x/client-web/examples/account/create-push-target.md new file mode 100644 index 0000000000..c987e3d2a8 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-push-target.md @@ -0,0 +1,15 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createPushTarget( + '', // targetId + '', // identifier + '' // providerId (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-recovery.md b/docs/examples/1.7.x/client-web/examples/account/create-recovery.md new file mode 100644 index 0000000000..f0a400d86d --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-recovery.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createRecovery( + 'email@example.com', // email + 'https://example.com' // url +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-session.md b/docs/examples/1.7.x/client-web/examples/account/create-session.md new file mode 100644 index 0000000000..b6d7ef8bbb --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-session.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createSession( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create-verification.md b/docs/examples/1.7.x/client-web/examples/account/create-verification.md new file mode 100644 index 0000000000..4a3b3144b6 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create-verification.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.createVerification( + 'https://example.com' // url +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/create.md b/docs/examples/1.7.x/client-web/examples/account/create.md new file mode 100644 index 0000000000..bf2dbec02a --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/create.md @@ -0,0 +1,16 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.create( + '', // userId + 'email@example.com', // email + '', // password + '' // name (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/delete-identity.md b/docs/examples/1.7.x/client-web/examples/account/delete-identity.md new file mode 100644 index 0000000000..f34baaaf5e --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/delete-identity.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deleteIdentity( + '' // identityId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/client-web/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..d11351442c --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,13 @@ +import { Client, Account, AuthenticatorType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deleteMfaAuthenticator( + AuthenticatorType.Totp // type +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/delete-push-target.md b/docs/examples/1.7.x/client-web/examples/account/delete-push-target.md new file mode 100644 index 0000000000..79bb06ed5d --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/delete-push-target.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deletePushTarget( + '' // targetId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/delete-session.md b/docs/examples/1.7.x/client-web/examples/account/delete-session.md new file mode 100644 index 0000000000..4d27221d85 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/delete-session.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deleteSession( + '' // sessionId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/delete-sessions.md b/docs/examples/1.7.x/client-web/examples/account/delete-sessions.md new file mode 100644 index 0000000000..c0fdf13924 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/delete-sessions.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.deleteSessions(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/client-web/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..850488b0c8 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.getMfaRecoveryCodes(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/get-prefs.md b/docs/examples/1.7.x/client-web/examples/account/get-prefs.md new file mode 100644 index 0000000000..f283832896 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/get-prefs.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.getPrefs(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/get-session.md b/docs/examples/1.7.x/client-web/examples/account/get-session.md new file mode 100644 index 0000000000..29af11052e --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/get-session.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.getSession( + '' // sessionId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/get.md b/docs/examples/1.7.x/client-web/examples/account/get.md new file mode 100644 index 0000000000..ea605914ce --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/get.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.get(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/list-identities.md b/docs/examples/1.7.x/client-web/examples/account/list-identities.md new file mode 100644 index 0000000000..54c569b836 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/list-identities.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listIdentities( + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/list-logs.md b/docs/examples/1.7.x/client-web/examples/account/list-logs.md new file mode 100644 index 0000000000..17c214f949 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/list-logs.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listLogs( + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/client-web/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..c9fa7da1bc --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/list-mfa-factors.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listMfaFactors(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/list-sessions.md b/docs/examples/1.7.x/client-web/examples/account/list-sessions.md new file mode 100644 index 0000000000..453e606517 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/list-sessions.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.listSessions(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-email.md b/docs/examples/1.7.x/client-web/examples/account/update-email.md new file mode 100644 index 0000000000..9e02fc9416 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-email.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateEmail( + 'email@example.com', // email + 'password' // password +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-m-f-a.md b/docs/examples/1.7.x/client-web/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..58b6a061b1 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-m-f-a.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMFA( + false // mfa +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/client-web/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..47501c528f --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMagicURLSession( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/client-web/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..74eedd8dc7 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-mfa-authenticator.md @@ -0,0 +1,14 @@ +import { Client, Account, AuthenticatorType } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMfaAuthenticator( + AuthenticatorType.Totp, // type + '' // otp +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/client-web/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..01a09dd354 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-mfa-challenge.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMfaChallenge( + '', // challengeId + '' // otp +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/client-web/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..24ff10b1e4 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateMfaRecoveryCodes(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-name.md b/docs/examples/1.7.x/client-web/examples/account/update-name.md new file mode 100644 index 0000000000..d6a6946795 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-name.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateName( + '' // name +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-password.md b/docs/examples/1.7.x/client-web/examples/account/update-password.md new file mode 100644 index 0000000000..575779e35c --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-password.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePassword( + '', // password + 'password' // oldPassword (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-phone-session.md b/docs/examples/1.7.x/client-web/examples/account/update-phone-session.md new file mode 100644 index 0000000000..092205ec6a --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-phone-session.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePhoneSession( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-phone-verification.md b/docs/examples/1.7.x/client-web/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..1b85178e76 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-phone-verification.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePhoneVerification( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-phone.md b/docs/examples/1.7.x/client-web/examples/account/update-phone.md new file mode 100644 index 0000000000..0c5ff216d8 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-phone.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePhone( + '+12065550100', // phone + 'password' // password +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-prefs.md b/docs/examples/1.7.x/client-web/examples/account/update-prefs.md new file mode 100644 index 0000000000..b9e88eac28 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-prefs.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePrefs( + {} // prefs +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-push-target.md b/docs/examples/1.7.x/client-web/examples/account/update-push-target.md new file mode 100644 index 0000000000..3475a22ba9 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-push-target.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updatePushTarget( + '', // targetId + '' // identifier +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-recovery.md b/docs/examples/1.7.x/client-web/examples/account/update-recovery.md new file mode 100644 index 0000000000..328e50ea4f --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-recovery.md @@ -0,0 +1,15 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateRecovery( + '', // userId + '', // secret + '' // password +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-session.md b/docs/examples/1.7.x/client-web/examples/account/update-session.md new file mode 100644 index 0000000000..4ccc8295d9 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-session.md @@ -0,0 +1,13 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateSession( + '' // sessionId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-status.md b/docs/examples/1.7.x/client-web/examples/account/update-status.md new file mode 100644 index 0000000000..932f167033 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-status.md @@ -0,0 +1,11 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateStatus(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/account/update-verification.md b/docs/examples/1.7.x/client-web/examples/account/update-verification.md new file mode 100644 index 0000000000..6d15aeec2e --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/account/update-verification.md @@ -0,0 +1,14 @@ +import { Client, Account } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const account = new Account(client); + +const result = await account.updateVerification( + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/avatars/get-browser.md b/docs/examples/1.7.x/client-web/examples/avatars/get-browser.md new file mode 100644 index 0000000000..08512d1dc7 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/avatars/get-browser.md @@ -0,0 +1,16 @@ +import { Client, Avatars, Browser } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getBrowser( + Browser.AvantBrowser, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/client-web/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..fb631a4e3e --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/avatars/get-credit-card.md @@ -0,0 +1,16 @@ +import { Client, Avatars, CreditCard } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getCreditCard( + CreditCard.AmericanExpress, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/avatars/get-favicon.md b/docs/examples/1.7.x/client-web/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..85317f1383 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/avatars/get-favicon.md @@ -0,0 +1,13 @@ +import { Client, Avatars } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getFavicon( + 'https://example.com' // url +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/avatars/get-flag.md b/docs/examples/1.7.x/client-web/examples/avatars/get-flag.md new file mode 100644 index 0000000000..bfbc6c2865 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/avatars/get-flag.md @@ -0,0 +1,16 @@ +import { Client, Avatars, Flag } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getFlag( + Flag.Afghanistan, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/avatars/get-image.md b/docs/examples/1.7.x/client-web/examples/avatars/get-image.md new file mode 100644 index 0000000000..36f88ecb52 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/avatars/get-image.md @@ -0,0 +1,15 @@ +import { Client, Avatars } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getImage( + 'https://example.com', // url + 0, // width (optional) + 0 // height (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/avatars/get-initials.md b/docs/examples/1.7.x/client-web/examples/avatars/get-initials.md new file mode 100644 index 0000000000..321c448807 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +import { Client, Avatars } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getInitials( + '', // name (optional) + 0, // width (optional) + 0, // height (optional) + '' // background (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/avatars/get-q-r.md b/docs/examples/1.7.x/client-web/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..cbbabbc2c8 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/avatars/get-q-r.md @@ -0,0 +1,16 @@ +import { Client, Avatars } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const avatars = new Avatars(client); + +const result = avatars.getQR( + '', // text + 1, // size (optional) + 0, // margin (optional) + false // download (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/databases/create-document.md b/docs/examples/1.7.x/client-web/examples/databases/create-document.md new file mode 100644 index 0000000000..401a67488c --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/databases/create-document.md @@ -0,0 +1,19 @@ +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setKey('') // + .setJWT(''); // Your secret JSON Web Token + +const databases = new Databases(client); + +const result = await databases.createDocument( + '', // databaseId + '', // collectionId + '', // documentId + {}, // data + ["read("any")"] // permissions (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/databases/delete-document.md b/docs/examples/1.7.x/client-web/examples/databases/delete-document.md new file mode 100644 index 0000000000..c9a1e9f759 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/databases/delete-document.md @@ -0,0 +1,15 @@ +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.deleteDocument( + '', // databaseId + '', // collectionId + '' // documentId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/databases/get-document.md b/docs/examples/1.7.x/client-web/examples/databases/get-document.md new file mode 100644 index 0000000000..a2836fc6ef --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/databases/get-document.md @@ -0,0 +1,16 @@ +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.getDocument( + '', // databaseId + '', // collectionId + '', // documentId + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/databases/list-documents.md b/docs/examples/1.7.x/client-web/examples/databases/list-documents.md new file mode 100644 index 0000000000..d00ac56390 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/databases/list-documents.md @@ -0,0 +1,15 @@ +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.listDocuments( + '', // databaseId + '', // collectionId + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/databases/update-document.md b/docs/examples/1.7.x/client-web/examples/databases/update-document.md new file mode 100644 index 0000000000..c0e06fce40 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/databases/update-document.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const databases = new Databases(client); + +const result = await databases.updateDocument( + '', // databaseId + '', // collectionId + '', // documentId + {}, // data (optional) + ["read("any")"] // permissions (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/functions/create-execution.md b/docs/examples/1.7.x/client-web/examples/functions/create-execution.md new file mode 100644 index 0000000000..8f07523b2b --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/functions/create-execution.md @@ -0,0 +1,19 @@ +import { Client, Functions, ExecutionMethod } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.createExecution( + '', // functionId + '', // body (optional) + false, // async (optional) + '', // path (optional) + ExecutionMethod.GET, // method (optional) + {}, // headers (optional) + '' // scheduledAt (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/functions/get-execution.md b/docs/examples/1.7.x/client-web/examples/functions/get-execution.md new file mode 100644 index 0000000000..9b88f81f6c --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/functions/get-execution.md @@ -0,0 +1,14 @@ +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.getExecution( + '', // functionId + '' // executionId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/functions/list-executions.md b/docs/examples/1.7.x/client-web/examples/functions/list-executions.md new file mode 100644 index 0000000000..9ec506346c --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/functions/list-executions.md @@ -0,0 +1,14 @@ +import { Client, Functions } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const functions = new Functions(client); + +const result = await functions.listExecutions( + '', // functionId + [] // queries (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/graphql/mutation.md b/docs/examples/1.7.x/client-web/examples/graphql/mutation.md new file mode 100644 index 0000000000..0e7466ac13 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/graphql/mutation.md @@ -0,0 +1,13 @@ +import { Client, Graphql } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const graphql = new Graphql(client); + +const result = await graphql.mutation( + {} // query +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/graphql/query.md b/docs/examples/1.7.x/client-web/examples/graphql/query.md new file mode 100644 index 0000000000..f9cd9b740f --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/graphql/query.md @@ -0,0 +1,13 @@ +import { Client, Graphql } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const graphql = new Graphql(client); + +const result = await graphql.query( + {} // query +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/locale/get.md b/docs/examples/1.7.x/client-web/examples/locale/get.md new file mode 100644 index 0000000000..bdd74722f4 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/locale/get.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.get(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/locale/list-codes.md b/docs/examples/1.7.x/client-web/examples/locale/list-codes.md new file mode 100644 index 0000000000..547bb056c0 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/locale/list-codes.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCodes(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/locale/list-continents.md b/docs/examples/1.7.x/client-web/examples/locale/list-continents.md new file mode 100644 index 0000000000..217ffc116c --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/locale/list-continents.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listContinents(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/client-web/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..515a3040ab --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/locale/list-countries-e-u.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCountriesEU(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/client-web/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..72a6a31d08 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/locale/list-countries-phones.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCountriesPhones(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/locale/list-countries.md b/docs/examples/1.7.x/client-web/examples/locale/list-countries.md new file mode 100644 index 0000000000..a127521f36 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/locale/list-countries.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCountries(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/locale/list-currencies.md b/docs/examples/1.7.x/client-web/examples/locale/list-currencies.md new file mode 100644 index 0000000000..e6ff0e1fce --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/locale/list-currencies.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listCurrencies(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/locale/list-languages.md b/docs/examples/1.7.x/client-web/examples/locale/list-languages.md new file mode 100644 index 0000000000..03b4e7d2c1 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/locale/list-languages.md @@ -0,0 +1,11 @@ +import { Client, Locale } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const locale = new Locale(client); + +const result = await locale.listLanguages(); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/client-web/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..254870985d --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/messaging/create-subscriber.md @@ -0,0 +1,15 @@ +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.createSubscriber( + '', // topicId + '', // subscriberId + '' // targetId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/client-web/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..3d5d0a4b42 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/messaging/delete-subscriber.md @@ -0,0 +1,14 @@ +import { Client, Messaging } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const messaging = new Messaging(client); + +const result = await messaging.deleteSubscriber( + '', // topicId + '' // subscriberId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/storage/create-file.md b/docs/examples/1.7.x/client-web/examples/storage/create-file.md new file mode 100644 index 0000000000..20a42206a2 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/storage/create-file.md @@ -0,0 +1,16 @@ +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.createFile( + '', // bucketId + '', // fileId + document.getElementById('uploader').files[0], // file + ["read("any")"] // permissions (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/storage/delete-file.md b/docs/examples/1.7.x/client-web/examples/storage/delete-file.md new file mode 100644 index 0000000000..373cdc03fc --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/storage/delete-file.md @@ -0,0 +1,14 @@ +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.deleteFile( + '', // bucketId + '' // fileId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/storage/get-file-download.md b/docs/examples/1.7.x/client-web/examples/storage/get-file-download.md new file mode 100644 index 0000000000..3ebb8f8f71 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/storage/get-file-download.md @@ -0,0 +1,15 @@ +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = storage.getFileDownload( + '', // bucketId + '', // fileId + '' // token (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/storage/get-file-preview.md b/docs/examples/1.7.x/client-web/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..ffc64c9f3a --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/storage/get-file-preview.md @@ -0,0 +1,26 @@ +import { Client, Storage, ImageGravity, ImageFormat } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = storage.getFilePreview( + '', // bucketId + '', // fileId + 0, // width (optional) + 0, // height (optional) + ImageGravity.Center, // gravity (optional) + -1, // quality (optional) + 0, // borderWidth (optional) + '', // borderColor (optional) + 0, // borderRadius (optional) + 0, // opacity (optional) + -360, // rotation (optional) + '', // background (optional) + ImageFormat.Jpg, // output (optional) + '' // token (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/storage/get-file-view.md b/docs/examples/1.7.x/client-web/examples/storage/get-file-view.md new file mode 100644 index 0000000000..add5a6fba5 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/storage/get-file-view.md @@ -0,0 +1,15 @@ +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = storage.getFileView( + '', // bucketId + '', // fileId + '' // token (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/storage/get-file.md b/docs/examples/1.7.x/client-web/examples/storage/get-file.md new file mode 100644 index 0000000000..10bd9fb775 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/storage/get-file.md @@ -0,0 +1,14 @@ +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.getFile( + '', // bucketId + '' // fileId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/storage/list-files.md b/docs/examples/1.7.x/client-web/examples/storage/list-files.md new file mode 100644 index 0000000000..f2c3ccb2b8 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/storage/list-files.md @@ -0,0 +1,15 @@ +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.listFiles( + '', // bucketId + [], // queries (optional) + '' // search (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/storage/update-file.md b/docs/examples/1.7.x/client-web/examples/storage/update-file.md new file mode 100644 index 0000000000..1432b85099 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/storage/update-file.md @@ -0,0 +1,16 @@ +import { Client, Storage } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const storage = new Storage(client); + +const result = await storage.updateFile( + '', // bucketId + '', // fileId + '', // name (optional) + ["read("any")"] // permissions (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/create-membership.md b/docs/examples/1.7.x/client-web/examples/teams/create-membership.md new file mode 100644 index 0000000000..8802e25af9 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/create-membership.md @@ -0,0 +1,19 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.createMembership( + '', // teamId + [], // roles + 'email@example.com', // email (optional) + '', // userId (optional) + '+12065550100', // phone (optional) + 'https://example.com', // url (optional) + '' // name (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/create.md b/docs/examples/1.7.x/client-web/examples/teams/create.md new file mode 100644 index 0000000000..b23f2201ac --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/create.md @@ -0,0 +1,15 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.create( + '', // teamId + '', // name + [] // roles (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/delete-membership.md b/docs/examples/1.7.x/client-web/examples/teams/delete-membership.md new file mode 100644 index 0000000000..2f360c3547 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/delete-membership.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.deleteMembership( + '', // teamId + '' // membershipId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/delete.md b/docs/examples/1.7.x/client-web/examples/teams/delete.md new file mode 100644 index 0000000000..5fd7f5d858 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/delete.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.delete( + '' // teamId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/get-membership.md b/docs/examples/1.7.x/client-web/examples/teams/get-membership.md new file mode 100644 index 0000000000..cd253fd6ef --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/get-membership.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.getMembership( + '', // teamId + '' // membershipId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/get-prefs.md b/docs/examples/1.7.x/client-web/examples/teams/get-prefs.md new file mode 100644 index 0000000000..a7f346f11f --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/get-prefs.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.getPrefs( + '' // teamId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/get.md b/docs/examples/1.7.x/client-web/examples/teams/get.md new file mode 100644 index 0000000000..539bdcf051 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/get.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.get( + '' // teamId +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/list-memberships.md b/docs/examples/1.7.x/client-web/examples/teams/list-memberships.md new file mode 100644 index 0000000000..e8cc39b5d8 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/list-memberships.md @@ -0,0 +1,15 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.listMemberships( + '', // teamId + [], // queries (optional) + '' // search (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/list.md b/docs/examples/1.7.x/client-web/examples/teams/list.md new file mode 100644 index 0000000000..4ca13ce8dd --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/list.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.list( + [], // queries (optional) + '' // search (optional) +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/update-membership-status.md b/docs/examples/1.7.x/client-web/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..89cc13cac2 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/update-membership-status.md @@ -0,0 +1,16 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.updateMembershipStatus( + '', // teamId + '', // membershipId + '', // userId + '' // secret +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/update-membership.md b/docs/examples/1.7.x/client-web/examples/teams/update-membership.md new file mode 100644 index 0000000000..fd6fffffcb --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/update-membership.md @@ -0,0 +1,15 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.updateMembership( + '', // teamId + '', // membershipId + [] // roles +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/update-name.md b/docs/examples/1.7.x/client-web/examples/teams/update-name.md new file mode 100644 index 0000000000..d91939ff73 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/update-name.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.updateName( + '', // teamId + '' // name +); + +console.log(result); diff --git a/docs/examples/1.7.x/client-web/examples/teams/update-prefs.md b/docs/examples/1.7.x/client-web/examples/teams/update-prefs.md new file mode 100644 index 0000000000..d7d4c36759 --- /dev/null +++ b/docs/examples/1.7.x/client-web/examples/teams/update-prefs.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "appwrite"; + +const client = new Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +const teams = new Teams(client); + +const result = await teams.updatePrefs( + '', // teamId + {} // prefs +); + +console.log(result); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-dart/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..7b1cc08304 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-anonymous-session.md @@ -0,0 +1,9 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.createAnonymousSession(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-dart/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..2305367d94 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-email-password-session.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.createEmailPasswordSession( + email: 'email@example.com', + password: 'password', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-email-token.md b/docs/examples/1.7.x/server-dart/examples/account/create-email-token.md new file mode 100644 index 0000000000..e9696f92bf --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-email-token.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.createEmailToken( + userId: '', + email: 'email@example.com', + phrase: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-dart/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..4288c71ce1 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-j-w-t.md @@ -0,0 +1,9 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Jwt result = await account.createJWT(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-dart/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..791b9cbd4f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.createMagicURLToken( + userId: '', + email: 'email@example.com', + url: 'https://example.com', // (optional) + phrase: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-dart/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..87797fa645 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-mfa-authenticator.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaType result = await account.createMfaAuthenticator( + type: AuthenticatorType.totp, +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-dart/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..62f3eaf2c2 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-mfa-challenge.md @@ -0,0 +1,11 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +MfaChallenge result = await account.createMfaChallenge( + factor: AuthenticationFactor.email, +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dart/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..5ebe0e9e92 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaRecoveryCodes result = await account.createMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-dart/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..4a26a9fd7f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-o-auth2token.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +await account.createOAuth2Token( + provider: OAuthProvider.amazon, + success: 'https://example.com', // (optional) + failure: 'https://example.com', // (optional) + scopes: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-dart/examples/account/create-phone-token.md new file mode 100644 index 0000000000..7011b3cf48 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-phone-token.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Token result = await account.createPhoneToken( + userId: '', + phone: '+12065550100', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-dart/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..8616834b27 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-phone-verification.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Token result = await account.createPhoneVerification(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-recovery.md b/docs/examples/1.7.x/server-dart/examples/account/create-recovery.md new file mode 100644 index 0000000000..f56d4227a9 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-recovery.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Token result = await account.createRecovery( + email: 'email@example.com', + url: 'https://example.com', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-session.md b/docs/examples/1.7.x/server-dart/examples/account/create-session.md new file mode 100644 index 0000000000..1e56fc71bb --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-session.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.createSession( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create-verification.md b/docs/examples/1.7.x/server-dart/examples/account/create-verification.md new file mode 100644 index 0000000000..150833cd6b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create-verification.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Token result = await account.createVerification( + url: 'https://example.com', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/create.md b/docs/examples/1.7.x/server-dart/examples/account/create.md new file mode 100644 index 0000000000..f0384f46f4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/create.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +User result = await account.create( + userId: '', + email: 'email@example.com', + password: '', + name: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/delete-identity.md b/docs/examples/1.7.x/server-dart/examples/account/delete-identity.md new file mode 100644 index 0000000000..124e6adad4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/delete-identity.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +await account.deleteIdentity( + identityId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-dart/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..efd5263e22 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +await account.deleteMfaAuthenticator( + type: AuthenticatorType.totp, +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/delete-session.md b/docs/examples/1.7.x/server-dart/examples/account/delete-session.md new file mode 100644 index 0000000000..d02808bbe9 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/delete-session.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +await account.deleteSession( + sessionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-dart/examples/account/delete-sessions.md new file mode 100644 index 0000000000..9406ca39d0 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/delete-sessions.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +await account.deleteSessions(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dart/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..b073d40238 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaRecoveryCodes result = await account.getMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/get-prefs.md b/docs/examples/1.7.x/server-dart/examples/account/get-prefs.md new file mode 100644 index 0000000000..94e10db1b6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/get-prefs.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Preferences result = await account.getPrefs(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/get-session.md b/docs/examples/1.7.x/server-dart/examples/account/get-session.md new file mode 100644 index 0000000000..3a81954bd9 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/get-session.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Session result = await account.getSession( + sessionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/get.md b/docs/examples/1.7.x/server-dart/examples/account/get.md new file mode 100644 index 0000000000..76a139a46a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/get.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.get(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/list-identities.md b/docs/examples/1.7.x/server-dart/examples/account/list-identities.md new file mode 100644 index 0000000000..a0b67851c2 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/list-identities.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +IdentityList result = await account.listIdentities( + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/list-logs.md b/docs/examples/1.7.x/server-dart/examples/account/list-logs.md new file mode 100644 index 0000000000..d3c50af1d5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/list-logs.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +LogList result = await account.listLogs( + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-dart/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..32b269fbd7 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/list-mfa-factors.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaFactors result = await account.listMfaFactors(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/list-sessions.md b/docs/examples/1.7.x/server-dart/examples/account/list-sessions.md new file mode 100644 index 0000000000..73cf462af6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/list-sessions.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +SessionList result = await account.listSessions(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-email.md b/docs/examples/1.7.x/server-dart/examples/account/update-email.md new file mode 100644 index 0000000000..cf6a56edcc --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-email.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.updateEmail( + email: 'email@example.com', + password: 'password', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-dart/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..947d862e46 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-m-f-a.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.updateMFA( + mfa: false, +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-dart/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..475e464ff0 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.updateMagicURLSession( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-dart/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..5a0f98f578 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-mfa-authenticator.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.updateMfaAuthenticator( + type: AuthenticatorType.totp, + otp: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-dart/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..749c4cd6a0 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-mfa-challenge.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Session result = await account.updateMfaChallenge( + challengeId: '', + otp: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dart/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..7e274f0ead --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +MfaRecoveryCodes result = await account.updateMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-name.md b/docs/examples/1.7.x/server-dart/examples/account/update-name.md new file mode 100644 index 0000000000..82cc3358a1 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-name.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.updateName( + name: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-password.md b/docs/examples/1.7.x/server-dart/examples/account/update-password.md new file mode 100644 index 0000000000..27d360ba51 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-password.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.updatePassword( + password: '', + oldPassword: 'password', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-dart/examples/account/update-phone-session.md new file mode 100644 index 0000000000..046dd0a701 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-phone-session.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject(''); // Your project ID + +Account account = Account(client); + +Session result = await account.updatePhoneSession( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-dart/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..f4b0c6fe6a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-phone-verification.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Token result = await account.updatePhoneVerification( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-phone.md b/docs/examples/1.7.x/server-dart/examples/account/update-phone.md new file mode 100644 index 0000000000..d861561b60 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-phone.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.updatePhone( + phone: '+12065550100', + password: 'password', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-prefs.md b/docs/examples/1.7.x/server-dart/examples/account/update-prefs.md new file mode 100644 index 0000000000..f4533cbea6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-prefs.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.updatePrefs( + prefs: {}, +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-recovery.md b/docs/examples/1.7.x/server-dart/examples/account/update-recovery.md new file mode 100644 index 0000000000..162ad58ac9 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-recovery.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Token result = await account.updateRecovery( + userId: '', + secret: '', + password: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-session.md b/docs/examples/1.7.x/server-dart/examples/account/update-session.md new file mode 100644 index 0000000000..a317a0840a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-session.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Session result = await account.updateSession( + sessionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-status.md b/docs/examples/1.7.x/server-dart/examples/account/update-status.md new file mode 100644 index 0000000000..2ee15d603c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-status.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +User result = await account.updateStatus(); diff --git a/docs/examples/1.7.x/server-dart/examples/account/update-verification.md b/docs/examples/1.7.x/server-dart/examples/account/update-verification.md new file mode 100644 index 0000000000..61904fd3f0 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/account/update-verification.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Account account = Account(client); + +Token result = await account.updateVerification( + userId: '', + secret: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-dart/examples/avatars/get-browser.md new file mode 100644 index 0000000000..8d5287511d --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/avatars/get-browser.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Avatars avatars = Avatars(client); + +UInt8List result = await avatars.getBrowser( + code: Browser.avantBrowser, + width: 0, // (optional) + height: 0, // (optional) + quality: -1, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-dart/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..88fe35ebd9 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/avatars/get-credit-card.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Avatars avatars = Avatars(client); + +UInt8List result = await avatars.getCreditCard( + code: CreditCard.americanExpress, + width: 0, // (optional) + height: 0, // (optional) + quality: -1, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-dart/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..d4cd8eae83 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/avatars/get-favicon.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Avatars avatars = Avatars(client); + +UInt8List result = await avatars.getFavicon( + url: 'https://example.com', +); diff --git a/docs/examples/1.7.x/server-dart/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-dart/examples/avatars/get-flag.md new file mode 100644 index 0000000000..56046681bc --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/avatars/get-flag.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Avatars avatars = Avatars(client); + +UInt8List result = await avatars.getFlag( + code: Flag.afghanistan, + width: 0, // (optional) + height: 0, // (optional) + quality: -1, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/avatars/get-image.md b/docs/examples/1.7.x/server-dart/examples/avatars/get-image.md new file mode 100644 index 0000000000..b6db1858c5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/avatars/get-image.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Avatars avatars = Avatars(client); + +UInt8List result = await avatars.getImage( + url: 'https://example.com', + width: 0, // (optional) + height: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-dart/examples/avatars/get-initials.md new file mode 100644 index 0000000000..7dc0989b4d --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/avatars/get-initials.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Avatars avatars = Avatars(client); + +UInt8List result = await avatars.getInitials( + name: '', // (optional) + width: 0, // (optional) + height: 0, // (optional) + background: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-dart/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..f64fe8a4ff --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/avatars/get-q-r.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Avatars avatars = Avatars(client); + +UInt8List result = await avatars.getQR( + text: '', + size: 1, // (optional) + margin: 0, // (optional) + download: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..13ca992889 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-boolean-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeBoolean result = await databases.createBooleanAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: false, // (optional) + array: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-collection.md b/docs/examples/1.7.x/server-dart/examples/databases/create-collection.md new file mode 100644 index 0000000000..61401761ec --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-collection.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +Collection result = await databases.createCollection( + databaseId: '', + collectionId: '', + name: '', + permissions: ["read("any")"], // (optional) + documentSecurity: false, // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..2591011423 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-datetime-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeDatetime result = await databases.createDatetimeAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-document.md b/docs/examples/1.7.x/server-dart/examples/databases/create-document.md new file mode 100644 index 0000000000..1c9af5112c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-document.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setKey('') // Your secret API key + .setJWT(''); // Your secret JSON Web Token + +Databases databases = Databases(client); + +Document result = await databases.createDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: {}, + permissions: ["read("any")"], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-documents.md b/docs/examples/1.7.x/server-dart/examples/databases/create-documents.md new file mode 100644 index 0000000000..7b4409a0b1 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-documents.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +DocumentList result = await databases.createDocuments( + databaseId: '', + collectionId: '', + documents: [], +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..216d020260 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-email-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeEmail result = await databases.createEmailAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: 'email@example.com', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..d45ca4476c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-enum-attribute.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeEnum result = await databases.createEnumAttribute( + databaseId: '', + collectionId: '', + key: '', + elements: [], + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..75d47f44ad --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-float-attribute.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeFloat result = await databases.createFloatAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-index.md b/docs/examples/1.7.x/server-dart/examples/databases/create-index.md new file mode 100644 index 0000000000..c3fa1abd60 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-index.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +Index result = await databases.createIndex( + databaseId: '', + collectionId: '', + key: '', + type: IndexType.key, + attributes: [], + orders: [], // (optional) + lengths: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..6511696f92 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-integer-attribute.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeInteger result = await databases.createIntegerAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + min: 0, // (optional) + max: 0, // (optional) + xdefault: 0, // (optional) + array: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..10ddb47bdf --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-ip-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeIp result = await databases.createIpAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..dcdf34fcb8 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-relationship-attribute.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeRelationship result = await databases.createRelationshipAttribute( + databaseId: '', + collectionId: '', + relatedCollectionId: '', + type: RelationshipType.oneToOne, + twoWay: false, // (optional) + key: '', // (optional) + twoWayKey: '', // (optional) + onDelete: RelationMutate.cascade, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..8785ea7647 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-string-attribute.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeString result = await databases.createStringAttribute( + databaseId: '', + collectionId: '', + key: '', + size: 1, + xrequired: false, + xdefault: '', // (optional) + array: false, // (optional) + encrypt: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..9088f8dfeb --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create-url-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeUrl result = await databases.createUrlAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: 'https://example.com', // (optional) + array: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/create.md b/docs/examples/1.7.x/server-dart/examples/databases/create.md new file mode 100644 index 0000000000..a2e978bd30 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/create.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +Database result = await databases.create( + databaseId: '', + name: '', + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..f9cbbd42ef --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/delete-attribute.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +await databases.deleteAttribute( + databaseId: '', + collectionId: '', + key: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-dart/examples/databases/delete-collection.md new file mode 100644 index 0000000000..919e17891b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/delete-collection.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +await databases.deleteCollection( + databaseId: '', + collectionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/delete-document.md b/docs/examples/1.7.x/server-dart/examples/databases/delete-document.md new file mode 100644 index 0000000000..dd04d89959 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/delete-document.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Databases databases = Databases(client); + +await databases.deleteDocument( + databaseId: '', + collectionId: '', + documentId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-dart/examples/databases/delete-documents.md new file mode 100644 index 0000000000..66bd5584c7 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/delete-documents.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +await databases.deleteDocuments( + databaseId: '', + collectionId: '', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/delete-index.md b/docs/examples/1.7.x/server-dart/examples/databases/delete-index.md new file mode 100644 index 0000000000..f16c84b9a7 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/delete-index.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +await databases.deleteIndex( + databaseId: '', + collectionId: '', + key: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/delete.md b/docs/examples/1.7.x/server-dart/examples/databases/delete.md new file mode 100644 index 0000000000..5e9042e542 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/delete.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +await databases.delete( + databaseId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/get-attribute.md new file mode 100644 index 0000000000..8329f8db05 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/get-attribute.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + + result = await databases.getAttribute( + databaseId: '', + collectionId: '', + key: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/get-collection.md b/docs/examples/1.7.x/server-dart/examples/databases/get-collection.md new file mode 100644 index 0000000000..b678420128 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/get-collection.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +Collection result = await databases.getCollection( + databaseId: '', + collectionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/get-document.md b/docs/examples/1.7.x/server-dart/examples/databases/get-document.md new file mode 100644 index 0000000000..45745186e6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/get-document.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Databases databases = Databases(client); + +Document result = await databases.getDocument( + databaseId: '', + collectionId: '', + documentId: '', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/get-index.md b/docs/examples/1.7.x/server-dart/examples/databases/get-index.md new file mode 100644 index 0000000000..848257960a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/get-index.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +Index result = await databases.getIndex( + databaseId: '', + collectionId: '', + key: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/get.md b/docs/examples/1.7.x/server-dart/examples/databases/get.md new file mode 100644 index 0000000000..28d3d2bd14 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/get.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +Database result = await databases.get( + databaseId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-dart/examples/databases/list-attributes.md new file mode 100644 index 0000000000..64aaf331b8 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/list-attributes.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeList result = await databases.listAttributes( + databaseId: '', + collectionId: '', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/list-collections.md b/docs/examples/1.7.x/server-dart/examples/databases/list-collections.md new file mode 100644 index 0000000000..69c2a0fe61 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/list-collections.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +CollectionList result = await databases.listCollections( + databaseId: '', + queries: [], // (optional) + search: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/list-documents.md b/docs/examples/1.7.x/server-dart/examples/databases/list-documents.md new file mode 100644 index 0000000000..cdecc59e33 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/list-documents.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Databases databases = Databases(client); + +DocumentList result = await databases.listDocuments( + databaseId: '', + collectionId: '', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-dart/examples/databases/list-indexes.md new file mode 100644 index 0000000000..38b95d5d5b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/list-indexes.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +IndexList result = await databases.listIndexes( + databaseId: '', + collectionId: '', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/list.md b/docs/examples/1.7.x/server-dart/examples/databases/list.md new file mode 100644 index 0000000000..2de4e97cf2 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/list.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +DatabaseList result = await databases.list( + queries: [], // (optional) + search: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..46e3ef4ce3 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-boolean-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeBoolean result = await databases.updateBooleanAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: false, + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-collection.md b/docs/examples/1.7.x/server-dart/examples/databases/update-collection.md new file mode 100644 index 0000000000..c3c565b231 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-collection.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +Collection result = await databases.updateCollection( + databaseId: '', + collectionId: '', + name: '', + permissions: ["read("any")"], // (optional) + documentSecurity: false, // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..ddc8f26a70 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-datetime-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeDatetime result = await databases.updateDatetimeAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: '', + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-document.md b/docs/examples/1.7.x/server-dart/examples/databases/update-document.md new file mode 100644 index 0000000000..47a1867c10 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-document.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Databases databases = Databases(client); + +Document result = await databases.updateDocument( + databaseId: '', + collectionId: '', + documentId: '', + data: {}, // (optional) + permissions: ["read("any")"], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-documents.md b/docs/examples/1.7.x/server-dart/examples/databases/update-documents.md new file mode 100644 index 0000000000..70b7cbf86d --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-documents.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +DocumentList result = await databases.updateDocuments( + databaseId: '', + collectionId: '', + data: {}, // (optional) + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..ee0e09719e --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-email-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeEmail result = await databases.updateEmailAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: 'email@example.com', + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..61ef4d0835 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-enum-attribute.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeEnum result = await databases.updateEnumAttribute( + databaseId: '', + collectionId: '', + key: '', + elements: [], + xrequired: false, + xdefault: '', + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..36f360eebc --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-float-attribute.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeFloat result = await databases.updateFloatAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: 0, + min: 0, // (optional) + max: 0, // (optional) + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..9089cc8bf6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-integer-attribute.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeInteger result = await databases.updateIntegerAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: 0, + min: 0, // (optional) + max: 0, // (optional) + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..e698a59e3a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-ip-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeIp result = await databases.updateIpAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: '', + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..28aac9643f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-relationship-attribute.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeRelationship result = await databases.updateRelationshipAttribute( + databaseId: '', + collectionId: '', + key: '', + onDelete: RelationMutate.cascade, // (optional) + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..7674f51c5b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-string-attribute.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeString result = await databases.updateStringAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: '', + size: 1, // (optional) + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-dart/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..3aaa01b441 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update-url-attribute.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +AttributeUrl result = await databases.updateUrlAttribute( + databaseId: '', + collectionId: '', + key: '', + xrequired: false, + xdefault: 'https://example.com', + newKey: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/update.md b/docs/examples/1.7.x/server-dart/examples/databases/update.md new file mode 100644 index 0000000000..a46f116389 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/update.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +Database result = await databases.update( + databaseId: '', + name: '', + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-dart/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..46611b3b1e --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/databases/upsert-documents.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Databases databases = Databases(client); + +DocumentList result = await databases.upsertDocuments( + databaseId: '', + collectionId: '', + documents: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-dart/examples/functions/create-deployment.md new file mode 100644 index 0000000000..f459b3dd89 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/create-deployment.md @@ -0,0 +1,17 @@ +import 'dart:io'; +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Deployment result = await functions.createDeployment( + functionId: '', + code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), + activate: false, + entrypoint: '', // (optional) + commands: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-dart/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..34ff5b2067 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Deployment result = await functions.createDuplicateDeployment( + functionId: '', + deploymentId: '', + buildId: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/create-execution.md b/docs/examples/1.7.x/server-dart/examples/functions/create-execution.md new file mode 100644 index 0000000000..2ae64bce55 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/create-execution.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Functions functions = Functions(client); + +Execution result = await functions.createExecution( + functionId: '', + body: '', // (optional) + xasync: false, // (optional) + path: '', // (optional) + method: ExecutionMethod.gET, // (optional) + headers: {}, // (optional) + scheduledAt: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-dart/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..cc293b0c3b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/create-template-deployment.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Deployment result = await functions.createTemplateDeployment( + functionId: '', + repository: '', + owner: '', + rootDirectory: '', + version: '', + activate: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/create-variable.md b/docs/examples/1.7.x/server-dart/examples/functions/create-variable.md new file mode 100644 index 0000000000..03e36d8275 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/create-variable.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Variable result = await functions.createVariable( + functionId: '', + key: '', + value: '', + secret: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-dart/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..ed315a54e3 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/create-vcs-deployment.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Deployment result = await functions.createVcsDeployment( + functionId: '', + type: VCSDeploymentType.branch, + reference: '', + activate: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/create.md b/docs/examples/1.7.x/server-dart/examples/functions/create.md new file mode 100644 index 0000000000..f3f2683000 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/create.md @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Func result = await functions.create( + functionId: '', + name: '', + runtime: .node145, + execute: ["any"], // (optional) + events: [], // (optional) + schedule: '', // (optional) + timeout: 1, // (optional) + enabled: false, // (optional) + logging: false, // (optional) + entrypoint: '', // (optional) + commands: '', // (optional) + scopes: [], // (optional) + installationId: '', // (optional) + providerRepositoryId: '', // (optional) + providerBranch: '', // (optional) + providerSilentMode: false, // (optional) + providerRootDirectory: '', // (optional) + specification: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-dart/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..8e4167f756 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/delete-deployment.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +await functions.deleteDeployment( + functionId: '', + deploymentId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-dart/examples/functions/delete-execution.md new file mode 100644 index 0000000000..d077bc9328 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/delete-execution.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +await functions.deleteExecution( + functionId: '', + executionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-dart/examples/functions/delete-variable.md new file mode 100644 index 0000000000..d4b2832830 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/delete-variable.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +await functions.deleteVariable( + functionId: '', + variableId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/delete.md b/docs/examples/1.7.x/server-dart/examples/functions/delete.md new file mode 100644 index 0000000000..38d360b764 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/delete.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +await functions.delete( + functionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-dart/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..e7bbacf344 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/get-deployment-download.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +UInt8List result = await functions.getDeploymentDownload( + functionId: '', + deploymentId: '', + type: DeploymentDownloadType.source, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-dart/examples/functions/get-deployment.md new file mode 100644 index 0000000000..805ca0b634 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/get-deployment.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Deployment result = await functions.getDeployment( + functionId: '', + deploymentId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/get-execution.md b/docs/examples/1.7.x/server-dart/examples/functions/get-execution.md new file mode 100644 index 0000000000..e0026e0c4b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/get-execution.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Functions functions = Functions(client); + +Execution result = await functions.getExecution( + functionId: '', + executionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/get-variable.md b/docs/examples/1.7.x/server-dart/examples/functions/get-variable.md new file mode 100644 index 0000000000..fe61cee587 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/get-variable.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Variable result = await functions.getVariable( + functionId: '', + variableId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/get.md b/docs/examples/1.7.x/server-dart/examples/functions/get.md new file mode 100644 index 0000000000..c92a4f746c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/get.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Func result = await functions.get( + functionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-dart/examples/functions/list-deployments.md new file mode 100644 index 0000000000..d07d2b32f3 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/list-deployments.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +DeploymentList result = await functions.listDeployments( + functionId: '', + queries: [], // (optional) + search: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/list-executions.md b/docs/examples/1.7.x/server-dart/examples/functions/list-executions.md new file mode 100644 index 0000000000..1dfd39093d --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/list-executions.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Functions functions = Functions(client); + +ExecutionList result = await functions.listExecutions( + functionId: '', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-dart/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..a99f872b7e --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/list-runtimes.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +RuntimeList result = await functions.listRuntimes(); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-dart/examples/functions/list-specifications.md new file mode 100644 index 0000000000..bec5d5e635 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/list-specifications.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +SpecificationList result = await functions.listSpecifications(); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/list-variables.md b/docs/examples/1.7.x/server-dart/examples/functions/list-variables.md new file mode 100644 index 0000000000..0fa3b002bf --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/list-variables.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +VariableList result = await functions.listVariables( + functionId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/list.md b/docs/examples/1.7.x/server-dart/examples/functions/list.md new file mode 100644 index 0000000000..8eaeec0625 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/list.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +FunctionList result = await functions.list( + queries: [], // (optional) + search: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-dart/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..2b068098af --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/update-deployment-status.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Deployment result = await functions.updateDeploymentStatus( + functionId: '', + deploymentId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-dart/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..0a5c09dd96 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/update-function-deployment.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Func result = await functions.updateFunctionDeployment( + functionId: '', + deploymentId: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/update-variable.md b/docs/examples/1.7.x/server-dart/examples/functions/update-variable.md new file mode 100644 index 0000000000..7330d9f850 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/update-variable.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Variable result = await functions.updateVariable( + functionId: '', + variableId: '', + key: '', + value: '', // (optional) + secret: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/functions/update.md b/docs/examples/1.7.x/server-dart/examples/functions/update.md new file mode 100644 index 0000000000..ebe3be8cc6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/functions/update.md @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Functions functions = Functions(client); + +Func result = await functions.update( + functionId: '', + name: '', + runtime: .node145, // (optional) + execute: ["any"], // (optional) + events: [], // (optional) + schedule: '', // (optional) + timeout: 1, // (optional) + enabled: false, // (optional) + logging: false, // (optional) + entrypoint: '', // (optional) + commands: '', // (optional) + scopes: [], // (optional) + installationId: '', // (optional) + providerRepositoryId: '', // (optional) + providerBranch: '', // (optional) + providerSilentMode: false, // (optional) + providerRootDirectory: '', // (optional) + specification: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/graphql/mutation.md b/docs/examples/1.7.x/server-dart/examples/graphql/mutation.md new file mode 100644 index 0000000000..a88749851c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/graphql/mutation.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Graphql graphql = Graphql(client); + +Any result = await graphql.mutation( + query: {}, +); diff --git a/docs/examples/1.7.x/server-dart/examples/graphql/query.md b/docs/examples/1.7.x/server-dart/examples/graphql/query.md new file mode 100644 index 0000000000..2dca8f2929 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/graphql/query.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Graphql graphql = Graphql(client); + +Any result = await graphql.query( + query: {}, +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-dart/examples/health/get-antivirus.md new file mode 100644 index 0000000000..395d1f84d1 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-antivirus.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthAntivirus result = await health.getAntivirus(); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-cache.md b/docs/examples/1.7.x/server-dart/examples/health/get-cache.md new file mode 100644 index 0000000000..6312e3cbe6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-cache.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthStatus result = await health.getCache(); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-certificate.md b/docs/examples/1.7.x/server-dart/examples/health/get-certificate.md new file mode 100644 index 0000000000..eac30a6aef --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-certificate.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthCertificate result = await health.getCertificate( + domain: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-d-b.md b/docs/examples/1.7.x/server-dart/examples/health/get-d-b.md new file mode 100644 index 0000000000..25ad9607f5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-d-b.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthStatus result = await health.getDB(); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-dart/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..6f80718f6b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-failed-jobs.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getFailedJobs( + name: .v1Database, + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-dart/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..d544fbfc40 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-pub-sub.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthStatus result = await health.getPubSub(); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..b48623ec18 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-builds.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueBuilds( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..d72ac97b14 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-certificates.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueCertificates( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..b9d8e8bc66 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-databases.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueDatabases( + name: '', // (optional) + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..3074cbb8ab --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-deletes.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueDeletes( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..727fd239cc --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-functions.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueFunctions( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..32d3e3bb7b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-logs.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueLogs( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..93ec993845 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-mails.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueMails( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..4ffd769d3c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-messaging.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueMessaging( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..fab19875e5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-migrations.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueMigrations( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..89a3d03179 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-stats-resources.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueStatsResources( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..473dcd15ee --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-usage.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueUsage( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-dart/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..523c1007f5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-queue-webhooks.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthQueue result = await health.getQueueWebhooks( + threshold: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-dart/examples/health/get-storage-local.md new file mode 100644 index 0000000000..c33cf555f3 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-storage-local.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthStatus result = await health.getStorageLocal(); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-storage.md b/docs/examples/1.7.x/server-dart/examples/health/get-storage.md new file mode 100644 index 0000000000..cb6c572154 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-storage.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthStatus result = await health.getStorage(); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get-time.md b/docs/examples/1.7.x/server-dart/examples/health/get-time.md new file mode 100644 index 0000000000..f4439957d9 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get-time.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthTime result = await health.getTime(); diff --git a/docs/examples/1.7.x/server-dart/examples/health/get.md b/docs/examples/1.7.x/server-dart/examples/health/get.md new file mode 100644 index 0000000000..3134490848 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/health/get.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Health health = Health(client); + +HealthStatus result = await health.get(); diff --git a/docs/examples/1.7.x/server-dart/examples/locale/get.md b/docs/examples/1.7.x/server-dart/examples/locale/get.md new file mode 100644 index 0000000000..dec6f068c6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/locale/get.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Locale locale = Locale(client); + +Locale result = await locale.get(); diff --git a/docs/examples/1.7.x/server-dart/examples/locale/list-codes.md b/docs/examples/1.7.x/server-dart/examples/locale/list-codes.md new file mode 100644 index 0000000000..9f9eac9f29 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/locale/list-codes.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Locale locale = Locale(client); + +LocaleCodeList result = await locale.listCodes(); diff --git a/docs/examples/1.7.x/server-dart/examples/locale/list-continents.md b/docs/examples/1.7.x/server-dart/examples/locale/list-continents.md new file mode 100644 index 0000000000..276738eac7 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/locale/list-continents.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Locale locale = Locale(client); + +ContinentList result = await locale.listContinents(); diff --git a/docs/examples/1.7.x/server-dart/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-dart/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..59596c624c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/locale/list-countries-e-u.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Locale locale = Locale(client); + +CountryList result = await locale.listCountriesEU(); diff --git a/docs/examples/1.7.x/server-dart/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-dart/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..2a2d32eaca --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/locale/list-countries-phones.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Locale locale = Locale(client); + +PhoneList result = await locale.listCountriesPhones(); diff --git a/docs/examples/1.7.x/server-dart/examples/locale/list-countries.md b/docs/examples/1.7.x/server-dart/examples/locale/list-countries.md new file mode 100644 index 0000000000..6b8343c6b3 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/locale/list-countries.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Locale locale = Locale(client); + +CountryList result = await locale.listCountries(); diff --git a/docs/examples/1.7.x/server-dart/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-dart/examples/locale/list-currencies.md new file mode 100644 index 0000000000..48247d98fe --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/locale/list-currencies.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Locale locale = Locale(client); + +CurrencyList result = await locale.listCurrencies(); diff --git a/docs/examples/1.7.x/server-dart/examples/locale/list-languages.md b/docs/examples/1.7.x/server-dart/examples/locale/list-languages.md new file mode 100644 index 0000000000..2376f18917 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/locale/list-languages.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setSession(''); // The user session to authenticate with + +Locale locale = Locale(client); + +LanguageList result = await locale.listLanguages(); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..82c1eb5da6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-apns-provider.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createApnsProvider( + providerId: '', + name: '', + authKey: '', // (optional) + authKeyId: '', // (optional) + teamId: '', // (optional) + bundleId: '', // (optional) + sandbox: false, // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-email.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-email.md new file mode 100644 index 0000000000..78c695c7ed --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-email.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Messaging messaging = Messaging(client); + +Message result = await messaging.createEmail( + messageId: '', + subject: '', + content: '', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + cc: [], // (optional) + bcc: [], // (optional) + attachments: [], // (optional) + draft: false, // (optional) + html: false, // (optional) + scheduledAt: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..25c2cb8cfa --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-fcm-provider.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createFcmProvider( + providerId: '', + name: '', + serviceAccountJSON: {}, // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..10d803d624 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createMailgunProvider( + providerId: '', + name: '', + apiKey: '', // (optional) + domain: '', // (optional) + isEuRegion: false, // (optional) + fromName: '', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..b283b75325 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-msg91provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createMsg91Provider( + providerId: '', + name: '', + templateId: '', // (optional) + senderId: '', // (optional) + authKey: '', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-push.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-push.md new file mode 100644 index 0000000000..58d82c7a0a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-push.md @@ -0,0 +1,30 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('') // Your project ID + .setKey(''); // Your secret API key + +Messaging messaging = Messaging(client); + +Message result = await messaging.createPush( + messageId: '', + title: '', // (optional) + body: '<BODY>', // (optional) + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + data: {}, // (optional) + action: '<ACTION>', // (optional) + image: '[ID1:ID2]', // (optional) + icon: '<ICON>', // (optional) + sound: '<SOUND>', // (optional) + color: '<COLOR>', // (optional) + tag: '<TAG>', // (optional) + badge: 0, // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) + contentAvailable: false, // (optional) + critical: false, // (optional) + priority: MessagePriority.normal, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..e759a26094 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createSendgridProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-sms.md new file mode 100644 index 0000000000..04a715870f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-sms.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Message result = await messaging.createSms( + messageId: '<MESSAGE_ID>', + content: '<CONTENT>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..6201987fbb --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-smtp-provider.md @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createSmtpProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', + port: 1, // (optional) + username: '<USERNAME>', // (optional) + password: '<PASSWORD>', // (optional) + encryption: SmtpEncryption.none, // (optional) + autoTLS: false, // (optional) + mailer: '<MAILER>', // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: 'email@example.com', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..5fd4859fb9 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-subscriber.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +Messaging messaging = Messaging(client); + +Subscriber result = await messaging.createSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', + targetId: '<TARGET_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..5417b951dd --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-telesign-provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createTelesignProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // (optional) + customerId: '<CUSTOMER_ID>', // (optional) + apiKey: '<API_KEY>', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..4cf6463b6e --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createTextmagicProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // (optional) + username: '<USERNAME>', // (optional) + apiKey: '<API_KEY>', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-topic.md new file mode 100644 index 0000000000..67e47412a1 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-topic.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Topic result = await messaging.createTopic( + topicId: '<TOPIC_ID>', + name: '<NAME>', + subscribe: ["any"], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..8c3370baa7 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-twilio-provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createTwilioProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // (optional) + accountSid: '<ACCOUNT_SID>', // (optional) + authToken: '<AUTH_TOKEN>', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..d625f38230 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/create-vonage-provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.createVonageProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // (optional) + apiKey: '<API_KEY>', // (optional) + apiSecret: '<API_SECRET>', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..361bacc2c3 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/delete-provider.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +await messaging.deleteProvider( + providerId: '<PROVIDER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-dart/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..e4a044c280 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/delete-subscriber.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +Messaging messaging = Messaging(client); + +await messaging.deleteSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-dart/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..59c5592c93 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/delete-topic.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +await messaging.deleteTopic( + topicId: '<TOPIC_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/delete.md b/docs/examples/1.7.x/server-dart/examples/messaging/delete.md new file mode 100644 index 0000000000..14b680ae99 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/delete.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +await messaging.delete( + messageId: '<MESSAGE_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/get-message.md b/docs/examples/1.7.x/server-dart/examples/messaging/get-message.md new file mode 100644 index 0000000000..ccc98961e7 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/get-message.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Message result = await messaging.getMessage( + messageId: '<MESSAGE_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/get-provider.md new file mode 100644 index 0000000000..a82ef15775 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/get-provider.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.getProvider( + providerId: '<PROVIDER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-dart/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..03f78b7fa4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/get-subscriber.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Subscriber result = await messaging.getSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-dart/examples/messaging/get-topic.md new file mode 100644 index 0000000000..204f875793 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/get-topic.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Topic result = await messaging.getTopic( + topicId: '<TOPIC_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-dart/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..1d2b1805b4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/list-message-logs.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +LogList result = await messaging.listMessageLogs( + messageId: '<MESSAGE_ID>', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-dart/examples/messaging/list-messages.md new file mode 100644 index 0000000000..2c0a142ee8 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/list-messages.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +MessageList result = await messaging.listMessages( + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-dart/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..9f40a5fa49 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/list-provider-logs.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +LogList result = await messaging.listProviderLogs( + providerId: '<PROVIDER_ID>', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-dart/examples/messaging/list-providers.md new file mode 100644 index 0000000000..df7a8a022c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/list-providers.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +ProviderList result = await messaging.listProviders( + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-dart/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..3a9593ca89 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +LogList result = await messaging.listSubscriberLogs( + subscriberId: '<SUBSCRIBER_ID>', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-dart/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..19d907cd9a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/list-subscribers.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +SubscriberList result = await messaging.listSubscribers( + topicId: '<TOPIC_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-dart/examples/messaging/list-targets.md new file mode 100644 index 0000000000..5a327773c2 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/list-targets.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +TargetList result = await messaging.listTargets( + messageId: '<MESSAGE_ID>', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-dart/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..0ab02eaa74 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/list-topic-logs.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +LogList result = await messaging.listTopicLogs( + topicId: '<TOPIC_ID>', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-dart/examples/messaging/list-topics.md new file mode 100644 index 0000000000..c5fdb4901f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/list-topics.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +TopicList result = await messaging.listTopics( + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..edc0a1f769 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-apns-provider.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateApnsProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + authKey: '<AUTH_KEY>', // (optional) + authKeyId: '<AUTH_KEY_ID>', // (optional) + teamId: '<TEAM_ID>', // (optional) + bundleId: '<BUNDLE_ID>', // (optional) + sandbox: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-email.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-email.md new file mode 100644 index 0000000000..b725cee5f0 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-email.md @@ -0,0 +1,23 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Message result = await messaging.updateEmail( + messageId: '<MESSAGE_ID>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + subject: '<SUBJECT>', // (optional) + content: '<CONTENT>', // (optional) + draft: false, // (optional) + html: false, // (optional) + cc: [], // (optional) + bcc: [], // (optional) + scheduledAt: '', // (optional) + attachments: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..1e2d8a8ca2 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-fcm-provider.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateFcmProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + serviceAccountJSON: {}, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..c042a6faaa --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateMailgunProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + apiKey: '<API_KEY>', // (optional) + domain: '<DOMAIN>', // (optional) + isEuRegion: false, // (optional) + enabled: false, // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: '<REPLY_TO_EMAIL>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..24290e958f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-msg91provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateMsg91Provider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + templateId: '<TEMPLATE_ID>', // (optional) + senderId: '<SENDER_ID>', // (optional) + authKey: '<AUTH_KEY>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-push.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-push.md new file mode 100644 index 0000000000..f7cc117b64 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-push.md @@ -0,0 +1,30 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Message result = await messaging.updatePush( + messageId: '<MESSAGE_ID>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + title: '<TITLE>', // (optional) + body: '<BODY>', // (optional) + data: {}, // (optional) + action: '<ACTION>', // (optional) + image: '[ID1:ID2]', // (optional) + icon: '<ICON>', // (optional) + sound: '<SOUND>', // (optional) + color: '<COLOR>', // (optional) + tag: '<TAG>', // (optional) + badge: 0, // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) + contentAvailable: false, // (optional) + critical: false, // (optional) + priority: MessagePriority.normal, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..53b8c33df4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,19 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateSendgridProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + apiKey: '<API_KEY>', // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: '<REPLY_TO_EMAIL>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-sms.md new file mode 100644 index 0000000000..f4356deed3 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-sms.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Message result = await messaging.updateSms( + messageId: '<MESSAGE_ID>', + topics: [], // (optional) + users: [], // (optional) + targets: [], // (optional) + content: '<CONTENT>', // (optional) + draft: false, // (optional) + scheduledAt: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..16530c01c8 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-smtp-provider.md @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateSmtpProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + host: '<HOST>', // (optional) + port: 1, // (optional) + username: '<USERNAME>', // (optional) + password: '<PASSWORD>', // (optional) + encryption: SmtpEncryption.none, // (optional) + autoTLS: false, // (optional) + mailer: '<MAILER>', // (optional) + fromName: '<FROM_NAME>', // (optional) + fromEmail: 'email@example.com', // (optional) + replyToName: '<REPLY_TO_NAME>', // (optional) + replyToEmail: '<REPLY_TO_EMAIL>', // (optional) + enabled: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..4bf76fbcfe --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-telesign-provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateTelesignProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + customerId: '<CUSTOMER_ID>', // (optional) + apiKey: '<API_KEY>', // (optional) + from: '<FROM>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..86bb985778 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateTextmagicProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + username: '<USERNAME>', // (optional) + apiKey: '<API_KEY>', // (optional) + from: '<FROM>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-topic.md new file mode 100644 index 0000000000..5311fd5e9b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-topic.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Topic result = await messaging.updateTopic( + topicId: '<TOPIC_ID>', + name: '<NAME>', // (optional) + subscribe: ["any"], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..8ace97521b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-twilio-provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateTwilioProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + accountSid: '<ACCOUNT_SID>', // (optional) + authToken: '<AUTH_TOKEN>', // (optional) + from: '<FROM>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-dart/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..e0d95d1cb4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/messaging/update-vonage-provider.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Messaging messaging = Messaging(client); + +Provider result = await messaging.updateVonageProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // (optional) + enabled: false, // (optional) + apiKey: '<API_KEY>', // (optional) + apiSecret: '<API_SECRET>', // (optional) + from: '<FROM>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-dart/examples/sites/create-deployment.md new file mode 100644 index 0000000000..93f9615b8b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/create-deployment.md @@ -0,0 +1,18 @@ +import 'dart:io'; +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Deployment result = await sites.createDeployment( + siteId: '<SITE_ID>', + code: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), + activate: false, + installCommand: '<INSTALL_COMMAND>', // (optional) + buildCommand: '<BUILD_COMMAND>', // (optional) + outputDirectory: '<OUTPUT_DIRECTORY>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-dart/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..1a3e84a33c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Deployment result = await sites.createDuplicateDeployment( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-dart/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..348b4652b6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/create-template-deployment.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Deployment result = await sites.createTemplateDeployment( + siteId: '<SITE_ID>', + repository: '<REPOSITORY>', + owner: '<OWNER>', + rootDirectory: '<ROOT_DIRECTORY>', + version: '<VERSION>', + activate: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/create-variable.md b/docs/examples/1.7.x/server-dart/examples/sites/create-variable.md new file mode 100644 index 0000000000..aa3c876174 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/create-variable.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Variable result = await sites.createVariable( + siteId: '<SITE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-dart/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..50f65b9603 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/create-vcs-deployment.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Deployment result = await sites.createVcsDeployment( + siteId: '<SITE_ID>', + type: VCSDeploymentType.branch, + reference: '<REFERENCE>', + activate: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/create.md b/docs/examples/1.7.x/server-dart/examples/sites/create.md new file mode 100644 index 0000000000..448abab1df --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/create.md @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Site result = await sites.create( + siteId: '<SITE_ID>', + name: '<NAME>', + framework: .analog, + buildRuntime: .node145, + enabled: false, // (optional) + logging: false, // (optional) + timeout: 1, // (optional) + installCommand: '<INSTALL_COMMAND>', // (optional) + buildCommand: '<BUILD_COMMAND>', // (optional) + outputDirectory: '<OUTPUT_DIRECTORY>', // (optional) + adapter: .static, // (optional) + installationId: '<INSTALLATION_ID>', // (optional) + fallbackFile: '<FALLBACK_FILE>', // (optional) + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // (optional) + providerBranch: '<PROVIDER_BRANCH>', // (optional) + providerSilentMode: false, // (optional) + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // (optional) + specification: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-dart/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..ca93ac668d --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/delete-deployment.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +await sites.deleteDeployment( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/delete-log.md b/docs/examples/1.7.x/server-dart/examples/sites/delete-log.md new file mode 100644 index 0000000000..c11ecab71e --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/delete-log.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +await sites.deleteLog( + siteId: '<SITE_ID>', + logId: '<LOG_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-dart/examples/sites/delete-variable.md new file mode 100644 index 0000000000..f04b9451ae --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/delete-variable.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +await sites.deleteVariable( + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/delete.md b/docs/examples/1.7.x/server-dart/examples/sites/delete.md new file mode 100644 index 0000000000..e81df372bc --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/delete.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +await sites.delete( + siteId: '<SITE_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-dart/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..ad21070b8a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/get-deployment-download.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +UInt8List result = await sites.getDeploymentDownload( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', + type: DeploymentDownloadType.source, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-dart/examples/sites/get-deployment.md new file mode 100644 index 0000000000..9acc89b56f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/get-deployment.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Deployment result = await sites.getDeployment( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/get-log.md b/docs/examples/1.7.x/server-dart/examples/sites/get-log.md new file mode 100644 index 0000000000..195f8aad2d --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/get-log.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Execution result = await sites.getLog( + siteId: '<SITE_ID>', + logId: '<LOG_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/get-variable.md b/docs/examples/1.7.x/server-dart/examples/sites/get-variable.md new file mode 100644 index 0000000000..637e08a58c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/get-variable.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Variable result = await sites.getVariable( + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/get.md b/docs/examples/1.7.x/server-dart/examples/sites/get.md new file mode 100644 index 0000000000..32abcfcffc --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/get.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Site result = await sites.get( + siteId: '<SITE_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-dart/examples/sites/list-deployments.md new file mode 100644 index 0000000000..6f6c9ce3f0 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/list-deployments.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +DeploymentList result = await sites.listDeployments( + siteId: '<SITE_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-dart/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..72a600fad3 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/list-frameworks.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +FrameworkList result = await sites.listFrameworks(); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/list-logs.md b/docs/examples/1.7.x/server-dart/examples/sites/list-logs.md new file mode 100644 index 0000000000..4ccf170f8b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/list-logs.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +ExecutionList result = await sites.listLogs( + siteId: '<SITE_ID>', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-dart/examples/sites/list-specifications.md new file mode 100644 index 0000000000..b81faf0e43 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/list-specifications.md @@ -0,0 +1,10 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +SpecificationList result = await sites.listSpecifications(); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/list-variables.md b/docs/examples/1.7.x/server-dart/examples/sites/list-variables.md new file mode 100644 index 0000000000..14be96629c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/list-variables.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +VariableList result = await sites.listVariables( + siteId: '<SITE_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/list.md b/docs/examples/1.7.x/server-dart/examples/sites/list.md new file mode 100644 index 0000000000..0dd52262f1 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/list.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +SiteList result = await sites.list( + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-dart/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..bd031cf27a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/update-deployment-status.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Deployment result = await sites.updateDeploymentStatus( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-dart/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..dbb4e27aa6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/update-site-deployment.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Site result = await sites.updateSiteDeployment( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/update-variable.md b/docs/examples/1.7.x/server-dart/examples/sites/update-variable.md new file mode 100644 index 0000000000..af2123c989 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/update-variable.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Variable result = await sites.updateVariable( + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', // (optional) + secret: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/sites/update.md b/docs/examples/1.7.x/server-dart/examples/sites/update.md new file mode 100644 index 0000000000..c13acfb25b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/sites/update.md @@ -0,0 +1,29 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Sites sites = Sites(client); + +Site result = await sites.update( + siteId: '<SITE_ID>', + name: '<NAME>', + framework: .analog, + enabled: false, // (optional) + logging: false, // (optional) + timeout: 1, // (optional) + installCommand: '<INSTALL_COMMAND>', // (optional) + buildCommand: '<BUILD_COMMAND>', // (optional) + outputDirectory: '<OUTPUT_DIRECTORY>', // (optional) + buildRuntime: .node145, // (optional) + adapter: .static, // (optional) + fallbackFile: '<FALLBACK_FILE>', // (optional) + installationId: '<INSTALLATION_ID>', // (optional) + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // (optional) + providerBranch: '<PROVIDER_BRANCH>', // (optional) + providerSilentMode: false, // (optional) + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // (optional) + specification: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-dart/examples/storage/create-bucket.md new file mode 100644 index 0000000000..c09a4f2c5d --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/create-bucket.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Storage storage = Storage(client); + +Bucket result = await storage.createBucket( + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], // (optional) + fileSecurity: false, // (optional) + enabled: false, // (optional) + maximumFileSize: 1, // (optional) + allowedFileExtensions: [], // (optional) + compression: .none, // (optional) + encryption: false, // (optional) + antivirus: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/create-file.md b/docs/examples/1.7.x/server-dart/examples/storage/create-file.md new file mode 100644 index 0000000000..e631416ecb --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/create-file.md @@ -0,0 +1,16 @@ +import 'dart:io'; +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Storage storage = Storage(client); + +File result = await storage.createFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'), + permissions: ["read("any")"], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-dart/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..1eb1b51ca2 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/delete-bucket.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Storage storage = Storage(client); + +await storage.deleteBucket( + bucketId: '<BUCKET_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/delete-file.md b/docs/examples/1.7.x/server-dart/examples/storage/delete-file.md new file mode 100644 index 0000000000..26dd602c7e --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/delete-file.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Storage storage = Storage(client); + +await storage.deleteFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-dart/examples/storage/get-bucket.md new file mode 100644 index 0000000000..3464d2233b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/get-bucket.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Storage storage = Storage(client); + +Bucket result = await storage.getBucket( + bucketId: '<BUCKET_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-dart/examples/storage/get-file-download.md new file mode 100644 index 0000000000..8c119c386c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/get-file-download.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Storage storage = Storage(client); + +UInt8List result = await storage.getFileDownload( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + token: '<TOKEN>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-dart/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..a1f3c09b33 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/get-file-preview.md @@ -0,0 +1,25 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Storage storage = Storage(client); + +UInt8List result = await storage.getFilePreview( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + width: 0, // (optional) + height: 0, // (optional) + gravity: ImageGravity.center, // (optional) + quality: -1, // (optional) + borderWidth: 0, // (optional) + borderColor: '', // (optional) + borderRadius: 0, // (optional) + opacity: 0, // (optional) + rotation: -360, // (optional) + background: '', // (optional) + output: ImageFormat.jpg, // (optional) + token: '<TOKEN>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-dart/examples/storage/get-file-view.md new file mode 100644 index 0000000000..d48b51c19c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/get-file-view.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Storage storage = Storage(client); + +UInt8List result = await storage.getFileView( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + token: '<TOKEN>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/get-file.md b/docs/examples/1.7.x/server-dart/examples/storage/get-file.md new file mode 100644 index 0000000000..f765c62356 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/get-file.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Storage storage = Storage(client); + +File result = await storage.getFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-dart/examples/storage/list-buckets.md new file mode 100644 index 0000000000..c20dac1968 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/list-buckets.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Storage storage = Storage(client); + +BucketList result = await storage.listBuckets( + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/list-files.md b/docs/examples/1.7.x/server-dart/examples/storage/list-files.md new file mode 100644 index 0000000000..28f85b091a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/list-files.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Storage storage = Storage(client); + +FileList result = await storage.listFiles( + bucketId: '<BUCKET_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-dart/examples/storage/update-bucket.md new file mode 100644 index 0000000000..b4e45e059c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/update-bucket.md @@ -0,0 +1,21 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Storage storage = Storage(client); + +Bucket result = await storage.updateBucket( + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], // (optional) + fileSecurity: false, // (optional) + enabled: false, // (optional) + maximumFileSize: 1, // (optional) + allowedFileExtensions: [], // (optional) + compression: .none, // (optional) + encryption: false, // (optional) + antivirus: false, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/storage/update-file.md b/docs/examples/1.7.x/server-dart/examples/storage/update-file.md new file mode 100644 index 0000000000..966883a1f9 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/storage/update-file.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Storage storage = Storage(client); + +File result = await storage.updateFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + name: '<NAME>', // (optional) + permissions: ["read("any")"], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/create-membership.md b/docs/examples/1.7.x/server-dart/examples/teams/create-membership.md new file mode 100644 index 0000000000..f13a6e69bb --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/create-membership.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +Membership result = await teams.createMembership( + teamId: '<TEAM_ID>', + roles: [], + email: 'email@example.com', // (optional) + userId: '<USER_ID>', // (optional) + phone: '+12065550100', // (optional) + url: 'https://example.com', // (optional) + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/create.md b/docs/examples/1.7.x/server-dart/examples/teams/create.md new file mode 100644 index 0000000000..772f3cfa86 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/create.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +Team result = await teams.create( + teamId: '<TEAM_ID>', + name: '<NAME>', + roles: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-dart/examples/teams/delete-membership.md new file mode 100644 index 0000000000..9d99cbbd3d --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/delete-membership.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +await teams.deleteMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/delete.md b/docs/examples/1.7.x/server-dart/examples/teams/delete.md new file mode 100644 index 0000000000..1c08ab8ed9 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/delete.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +await teams.delete( + teamId: '<TEAM_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/get-membership.md b/docs/examples/1.7.x/server-dart/examples/teams/get-membership.md new file mode 100644 index 0000000000..0bdc63f8d4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/get-membership.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +Membership result = await teams.getMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-dart/examples/teams/get-prefs.md new file mode 100644 index 0000000000..e206393320 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/get-prefs.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +Preferences result = await teams.getPrefs( + teamId: '<TEAM_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/get.md b/docs/examples/1.7.x/server-dart/examples/teams/get.md new file mode 100644 index 0000000000..bb3bcaf7e2 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/get.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +Team result = await teams.get( + teamId: '<TEAM_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-dart/examples/teams/list-memberships.md new file mode 100644 index 0000000000..3c01dec4c5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/list-memberships.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +MembershipList result = await teams.listMemberships( + teamId: '<TEAM_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/list.md b/docs/examples/1.7.x/server-dart/examples/teams/list.md new file mode 100644 index 0000000000..093a139f71 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/list.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +TeamList result = await teams.list( + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-dart/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..c947162fa4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/update-membership-status.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +Membership result = await teams.updateMembershipStatus( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + userId: '<USER_ID>', + secret: '<SECRET>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/update-membership.md b/docs/examples/1.7.x/server-dart/examples/teams/update-membership.md new file mode 100644 index 0000000000..87a4325857 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/update-membership.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +Membership result = await teams.updateMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + roles: [], +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/update-name.md b/docs/examples/1.7.x/server-dart/examples/teams/update-name.md new file mode 100644 index 0000000000..fe3a9faabf --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/update-name.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +Team result = await teams.updateName( + teamId: '<TEAM_ID>', + name: '<NAME>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-dart/examples/teams/update-prefs.md new file mode 100644 index 0000000000..57518ada43 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/teams/update-prefs.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +Teams teams = Teams(client); + +Preferences result = await teams.updatePrefs( + teamId: '<TEAM_ID>', + prefs: {}, +); diff --git a/docs/examples/1.7.x/server-dart/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-dart/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..cc75a91726 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/tokens/create-file-token.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Tokens tokens = Tokens(client); + +ResourceToken result = await tokens.createFileToken( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + expire: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/tokens/delete.md b/docs/examples/1.7.x/server-dart/examples/tokens/delete.md new file mode 100644 index 0000000000..ce95e7b752 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/tokens/delete.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Tokens tokens = Tokens(client); + +await tokens.delete( + tokenId: '<TOKEN_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/tokens/get.md b/docs/examples/1.7.x/server-dart/examples/tokens/get.md new file mode 100644 index 0000000000..3112b5e1e5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/tokens/get.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Tokens tokens = Tokens(client); + +ResourceToken result = await tokens.get( + tokenId: '<TOKEN_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/tokens/list.md b/docs/examples/1.7.x/server-dart/examples/tokens/list.md new file mode 100644 index 0000000000..5331e44de3 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/tokens/list.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Tokens tokens = Tokens(client); + +ResourceTokenList result = await tokens.list( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/tokens/update.md b/docs/examples/1.7.x/server-dart/examples/tokens/update.md new file mode 100644 index 0000000000..47e910d574 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/tokens/update.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Tokens tokens = Tokens(client); + +ResourceToken result = await tokens.update( + tokenId: '<TOKEN_ID>', + expire: '', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-dart/examples/users/create-argon2user.md new file mode 100644 index 0000000000..38b0255ea4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-argon2user.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.createArgon2User( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-dart/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..aa898ba22f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-bcrypt-user.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.createBcryptUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-dart/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..6e8b7a2bac --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-j-w-t.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +Jwt result = await users.createJWT( + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', // (optional) + duration: 0, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-dart/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..e08edd617f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-m-d5user.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.createMD5User( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dart/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..c2b9562e4e --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +MfaRecoveryCodes result = await users.createMfaRecoveryCodes( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-dart/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..9f23baaef2 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-p-h-pass-user.md @@ -0,0 +1,15 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.createPHPassUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-dart/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..628cf3297e --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-s-h-a-user.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.createSHAUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordVersion: PasswordHash.sha1, // (optional) + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-dart/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..34bfbf66c4 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,18 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.createScryptModifiedUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', + passwordSignerKey: '<PASSWORD_SIGNER_KEY>', + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-dart/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..20cf911a09 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-scrypt-user.md @@ -0,0 +1,20 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.createScryptUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordCpu: 0, + passwordMemory: 0, + passwordParallel: 0, + passwordLength: 0, + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-session.md b/docs/examples/1.7.x/server-dart/examples/users/create-session.md new file mode 100644 index 0000000000..4293e7edf6 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-session.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +Session result = await users.createSession( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-target.md b/docs/examples/1.7.x/server-dart/examples/users/create-target.md new file mode 100644 index 0000000000..354a8dbb48 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-target.md @@ -0,0 +1,17 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +Target result = await users.createTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + providerType: MessagingProviderType.email, + identifier: '<IDENTIFIER>', + providerId: '<PROVIDER_ID>', // (optional) + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create-token.md b/docs/examples/1.7.x/server-dart/examples/users/create-token.md new file mode 100644 index 0000000000..ab7acba3dd --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create-token.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +Token result = await users.createToken( + userId: '<USER_ID>', + length: 4, // (optional) + expire: 60, // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/create.md b/docs/examples/1.7.x/server-dart/examples/users/create.md new file mode 100644 index 0000000000..b4953748e5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/create.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.create( + userId: '<USER_ID>', + email: 'email@example.com', // (optional) + phone: '+12065550100', // (optional) + password: '', // (optional) + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/delete-identity.md b/docs/examples/1.7.x/server-dart/examples/users/delete-identity.md new file mode 100644 index 0000000000..7ac2da9000 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/delete-identity.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +await users.deleteIdentity( + identityId: '<IDENTITY_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-dart/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..eed7dbd41b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +await users.deleteMfaAuthenticator( + userId: '<USER_ID>', + type: AuthenticatorType.totp, +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/delete-session.md b/docs/examples/1.7.x/server-dart/examples/users/delete-session.md new file mode 100644 index 0000000000..68d243e52f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/delete-session.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +await users.deleteSession( + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-dart/examples/users/delete-sessions.md new file mode 100644 index 0000000000..07c3566a7c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/delete-sessions.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +await users.deleteSessions( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/delete-target.md b/docs/examples/1.7.x/server-dart/examples/users/delete-target.md new file mode 100644 index 0000000000..aa27b32d38 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/delete-target.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +await users.deleteTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/delete.md b/docs/examples/1.7.x/server-dart/examples/users/delete.md new file mode 100644 index 0000000000..93819b72d7 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/delete.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +await users.delete( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dart/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..cf66c67610 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +MfaRecoveryCodes result = await users.getMfaRecoveryCodes( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/get-prefs.md b/docs/examples/1.7.x/server-dart/examples/users/get-prefs.md new file mode 100644 index 0000000000..146cff6820 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/get-prefs.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +Preferences result = await users.getPrefs( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/get-target.md b/docs/examples/1.7.x/server-dart/examples/users/get-target.md new file mode 100644 index 0000000000..9ddaafb55f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/get-target.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +Target result = await users.getTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/get.md b/docs/examples/1.7.x/server-dart/examples/users/get.md new file mode 100644 index 0000000000..a171b79582 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/get.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.get( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/list-identities.md b/docs/examples/1.7.x/server-dart/examples/users/list-identities.md new file mode 100644 index 0000000000..2c14775e9a --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/list-identities.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +IdentityList result = await users.listIdentities( + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/list-logs.md b/docs/examples/1.7.x/server-dart/examples/users/list-logs.md new file mode 100644 index 0000000000..5885dcb874 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/list-logs.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +LogList result = await users.listLogs( + userId: '<USER_ID>', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/list-memberships.md b/docs/examples/1.7.x/server-dart/examples/users/list-memberships.md new file mode 100644 index 0000000000..dabe5a123c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/list-memberships.md @@ -0,0 +1,14 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +MembershipList result = await users.listMemberships( + userId: '<USER_ID>', + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-dart/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..7134ee5dab --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/list-mfa-factors.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +MfaFactors result = await users.listMfaFactors( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/list-sessions.md b/docs/examples/1.7.x/server-dart/examples/users/list-sessions.md new file mode 100644 index 0000000000..22a37c05a0 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/list-sessions.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +SessionList result = await users.listSessions( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/list-targets.md b/docs/examples/1.7.x/server-dart/examples/users/list-targets.md new file mode 100644 index 0000000000..971fbea0e1 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/list-targets.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +TargetList result = await users.listTargets( + userId: '<USER_ID>', + queries: [], // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/list.md b/docs/examples/1.7.x/server-dart/examples/users/list.md new file mode 100644 index 0000000000..6d34bb470b --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/list.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +UserList result = await users.list( + queries: [], // (optional) + search: '<SEARCH>', // (optional) +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-dart/examples/users/update-email-verification.md new file mode 100644 index 0000000000..9930e30be5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-email-verification.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.updateEmailVerification( + userId: '<USER_ID>', + emailVerification: false, +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-email.md b/docs/examples/1.7.x/server-dart/examples/users/update-email.md new file mode 100644 index 0000000000..129a8e2437 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-email.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.updateEmail( + userId: '<USER_ID>', + email: 'email@example.com', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-labels.md b/docs/examples/1.7.x/server-dart/examples/users/update-labels.md new file mode 100644 index 0000000000..d247bf5e74 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-labels.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.updateLabels( + userId: '<USER_ID>', + labels: [], +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dart/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..3b7d81f57c --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +MfaRecoveryCodes result = await users.updateMfaRecoveryCodes( + userId: '<USER_ID>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-mfa.md b/docs/examples/1.7.x/server-dart/examples/users/update-mfa.md new file mode 100644 index 0000000000..f26b105534 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-mfa.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.updateMfa( + userId: '<USER_ID>', + mfa: false, +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-name.md b/docs/examples/1.7.x/server-dart/examples/users/update-name.md new file mode 100644 index 0000000000..905cee0e49 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-name.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.updateName( + userId: '<USER_ID>', + name: '<NAME>', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-password.md b/docs/examples/1.7.x/server-dart/examples/users/update-password.md new file mode 100644 index 0000000000..14e27482ec --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-password.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.updatePassword( + userId: '<USER_ID>', + password: '', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-dart/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..b57aafab1f --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-phone-verification.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.updatePhoneVerification( + userId: '<USER_ID>', + phoneVerification: false, +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-phone.md b/docs/examples/1.7.x/server-dart/examples/users/update-phone.md new file mode 100644 index 0000000000..aa891d2351 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-phone.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.updatePhone( + userId: '<USER_ID>', + number: '+12065550100', +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-prefs.md b/docs/examples/1.7.x/server-dart/examples/users/update-prefs.md new file mode 100644 index 0000000000..87fc2968f5 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-prefs.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +Preferences result = await users.updatePrefs( + userId: '<USER_ID>', + prefs: {}, +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-status.md b/docs/examples/1.7.x/server-dart/examples/users/update-status.md new file mode 100644 index 0000000000..4d8dca03ad --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-status.md @@ -0,0 +1,13 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +User result = await users.updateStatus( + userId: '<USER_ID>', + status: false, +); diff --git a/docs/examples/1.7.x/server-dart/examples/users/update-target.md b/docs/examples/1.7.x/server-dart/examples/users/update-target.md new file mode 100644 index 0000000000..f66f0b7475 --- /dev/null +++ b/docs/examples/1.7.x/server-dart/examples/users/update-target.md @@ -0,0 +1,16 @@ +import 'package:dart_appwrite/dart_appwrite.dart'; + +Client client = Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +Users users = Users(client); + +Target result = await users.updateTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>', // (optional) + providerId: '<PROVIDER_ID>', // (optional) + name: '<NAME>', // (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-deno/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..62ad345304 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-anonymous-session.md @@ -0,0 +1,9 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.createAnonymousSession(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-deno/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..d08a92d2c3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-email-password-session.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.createEmailPasswordSession( + 'email@example.com', // email + 'password' // password +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-email-token.md b/docs/examples/1.7.x/server-deno/examples/account/create-email-token.md new file mode 100644 index 0000000000..384a3fbbea --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-email-token.md @@ -0,0 +1,13 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.createEmailToken( + '<USER_ID>', // userId + 'email@example.com', // email + false // phrase (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-deno/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..a0a7f722cc --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-j-w-t.md @@ -0,0 +1,9 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.createJWT(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-deno/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..29e552a819 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,14 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.createMagicURLToken( + '<USER_ID>', // userId + 'email@example.com', // email + 'https://example.com', // url (optional) + false // phrase (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-deno/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..52c193a848 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-mfa-authenticator.md @@ -0,0 +1,12 @@ +import { Client, Account, AuthenticatorType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.createMfaAuthenticator( + AuthenticatorType.Totp // type +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-deno/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..296e36dec4 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-mfa-challenge.md @@ -0,0 +1,11 @@ +import { Client, Account, AuthenticationFactor } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.createMfaChallenge( + AuthenticationFactor.Email // factor +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-deno/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..cfd9aa2ba8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.createMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-deno/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..24e43a9d9c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-o-auth2token.md @@ -0,0 +1,14 @@ +import { Client, Account, OAuthProvider } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +account.createOAuth2Token( + OAuthProvider.Amazon, // provider + 'https://example.com', // success (optional) + 'https://example.com', // failure (optional) + [] // scopes (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-deno/examples/account/create-phone-token.md new file mode 100644 index 0000000000..77e4adcb9c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-phone-token.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.createPhoneToken( + '<USER_ID>', // userId + '+12065550100' // phone +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-deno/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..8f01304f5b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-phone-verification.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.createPhoneVerification(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-recovery.md b/docs/examples/1.7.x/server-deno/examples/account/create-recovery.md new file mode 100644 index 0000000000..a3d92d866e --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-recovery.md @@ -0,0 +1,13 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.createRecovery( + 'email@example.com', // email + 'https://example.com' // url +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-session.md b/docs/examples/1.7.x/server-deno/examples/account/create-session.md new file mode 100644 index 0000000000..888493a21a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-session.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.createSession( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create-verification.md b/docs/examples/1.7.x/server-deno/examples/account/create-verification.md new file mode 100644 index 0000000000..438feee807 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create-verification.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.createVerification( + 'https://example.com' // url +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/create.md b/docs/examples/1.7.x/server-deno/examples/account/create.md new file mode 100644 index 0000000000..c410a0f7c7 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/create.md @@ -0,0 +1,14 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.create( + '<USER_ID>', // userId + 'email@example.com', // email + '', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/delete-identity.md b/docs/examples/1.7.x/server-deno/examples/account/delete-identity.md new file mode 100644 index 0000000000..359c7a3cfa --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/delete-identity.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.deleteIdentity( + '<IDENTITY_ID>' // identityId +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-deno/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..f4b164b43d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,12 @@ +import { Client, Account, AuthenticatorType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.deleteMfaAuthenticator( + AuthenticatorType.Totp // type +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/delete-session.md b/docs/examples/1.7.x/server-deno/examples/account/delete-session.md new file mode 100644 index 0000000000..a0b7d19687 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/delete-session.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.deleteSession( + '<SESSION_ID>' // sessionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-deno/examples/account/delete-sessions.md new file mode 100644 index 0000000000..864c50535b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/delete-sessions.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.deleteSessions(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-deno/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..73fc143978 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.getMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/get-prefs.md b/docs/examples/1.7.x/server-deno/examples/account/get-prefs.md new file mode 100644 index 0000000000..4479df71f7 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/get-prefs.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.getPrefs(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/get-session.md b/docs/examples/1.7.x/server-deno/examples/account/get-session.md new file mode 100644 index 0000000000..c380b72ed5 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/get-session.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.getSession( + '<SESSION_ID>' // sessionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/get.md b/docs/examples/1.7.x/server-deno/examples/account/get.md new file mode 100644 index 0000000000..5abdc95ec7 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/get.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.get(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/list-identities.md b/docs/examples/1.7.x/server-deno/examples/account/list-identities.md new file mode 100644 index 0000000000..1c612f9737 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/list-identities.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.listIdentities( + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/list-logs.md b/docs/examples/1.7.x/server-deno/examples/account/list-logs.md new file mode 100644 index 0000000000..28ab351f5a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/list-logs.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.listLogs( + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-deno/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..35fb7497de --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/list-mfa-factors.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.listMfaFactors(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/list-sessions.md b/docs/examples/1.7.x/server-deno/examples/account/list-sessions.md new file mode 100644 index 0000000000..e34da16995 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/list-sessions.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.listSessions(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-email.md b/docs/examples/1.7.x/server-deno/examples/account/update-email.md new file mode 100644 index 0000000000..0753cff9fd --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-email.md @@ -0,0 +1,13 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateEmail( + 'email@example.com', // email + 'password' // password +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-deno/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..24611aa43a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-m-f-a.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateMFA( + false // mfa +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-deno/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..a83c1d91a4 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.updateMagicURLSession( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-deno/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..6b95818e06 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-mfa-authenticator.md @@ -0,0 +1,13 @@ +import { Client, Account, AuthenticatorType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateMfaAuthenticator( + AuthenticatorType.Totp, // type + '<OTP>' // otp +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-deno/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..61a7b44fd0 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-mfa-challenge.md @@ -0,0 +1,13 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateMfaChallenge( + '<CHALLENGE_ID>', // challengeId + '<OTP>' // otp +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-deno/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..2030e1c551 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-name.md b/docs/examples/1.7.x/server-deno/examples/account/update-name.md new file mode 100644 index 0000000000..a02591b3b5 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-name.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateName( + '<NAME>' // name +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-password.md b/docs/examples/1.7.x/server-deno/examples/account/update-password.md new file mode 100644 index 0000000000..088bea88ac --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-password.md @@ -0,0 +1,13 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updatePassword( + '', // password + 'password' // oldPassword (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-deno/examples/account/update-phone-session.md new file mode 100644 index 0000000000..4710a451a8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-phone-session.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new Account(client); + +const response = await account.updatePhoneSession( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-deno/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..3b150c8c4a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-phone-verification.md @@ -0,0 +1,13 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updatePhoneVerification( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-phone.md b/docs/examples/1.7.x/server-deno/examples/account/update-phone.md new file mode 100644 index 0000000000..9c1923c217 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-phone.md @@ -0,0 +1,13 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updatePhone( + '+12065550100', // phone + 'password' // password +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-prefs.md b/docs/examples/1.7.x/server-deno/examples/account/update-prefs.md new file mode 100644 index 0000000000..4b37a64fe7 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-prefs.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updatePrefs( + {} // prefs +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-recovery.md b/docs/examples/1.7.x/server-deno/examples/account/update-recovery.md new file mode 100644 index 0000000000..5d0d80f956 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-recovery.md @@ -0,0 +1,14 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateRecovery( + '<USER_ID>', // userId + '<SECRET>', // secret + '' // password +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-session.md b/docs/examples/1.7.x/server-deno/examples/account/update-session.md new file mode 100644 index 0000000000..cb36b9491e --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-session.md @@ -0,0 +1,12 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateSession( + '<SESSION_ID>' // sessionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-status.md b/docs/examples/1.7.x/server-deno/examples/account/update-status.md new file mode 100644 index 0000000000..0c70c88b51 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-status.md @@ -0,0 +1,10 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateStatus(); diff --git a/docs/examples/1.7.x/server-deno/examples/account/update-verification.md b/docs/examples/1.7.x/server-deno/examples/account/update-verification.md new file mode 100644 index 0000000000..96370858cd --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/account/update-verification.md @@ -0,0 +1,13 @@ +import { Client, Account } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new Account(client); + +const response = await account.updateVerification( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-deno/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-deno/examples/avatars/get-browser.md new file mode 100644 index 0000000000..5443200b39 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/avatars/get-browser.md @@ -0,0 +1,15 @@ +import { Client, Avatars, Browser } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new Avatars(client); + +const result = avatars.getBrowser( + Browser.AvantBrowser, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-deno/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..8bcc67e08c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/avatars/get-credit-card.md @@ -0,0 +1,15 @@ +import { Client, Avatars, CreditCard } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new Avatars(client); + +const result = avatars.getCreditCard( + CreditCard.AmericanExpress, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-deno/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..cca313a9a2 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/avatars/get-favicon.md @@ -0,0 +1,12 @@ +import { Client, Avatars } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new Avatars(client); + +const result = avatars.getFavicon( + 'https://example.com' // url +); diff --git a/docs/examples/1.7.x/server-deno/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-deno/examples/avatars/get-flag.md new file mode 100644 index 0000000000..6837438c10 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/avatars/get-flag.md @@ -0,0 +1,15 @@ +import { Client, Avatars, Flag } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new Avatars(client); + +const result = avatars.getFlag( + Flag.Afghanistan, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/avatars/get-image.md b/docs/examples/1.7.x/server-deno/examples/avatars/get-image.md new file mode 100644 index 0000000000..2960daba8d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/avatars/get-image.md @@ -0,0 +1,14 @@ +import { Client, Avatars } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new Avatars(client); + +const result = avatars.getImage( + 'https://example.com', // url + 0, // width (optional) + 0 // height (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-deno/examples/avatars/get-initials.md new file mode 100644 index 0000000000..10eb2d80b8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/avatars/get-initials.md @@ -0,0 +1,15 @@ +import { Client, Avatars } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new Avatars(client); + +const result = avatars.getInitials( + '<NAME>', // name (optional) + 0, // width (optional) + 0, // height (optional) + '' // background (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-deno/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..d9ccc0dbca --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/avatars/get-q-r.md @@ -0,0 +1,15 @@ +import { Client, Avatars } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new Avatars(client); + +const result = avatars.getQR( + '<TEXT>', // text + 1, // size (optional) + 0, // margin (optional) + false // download (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..b216c2ead3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-boolean-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createBooleanAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + false, // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-collection.md b/docs/examples/1.7.x/server-deno/examples/databases/create-collection.md new file mode 100644 index 0000000000..c7e8026758 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-collection.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createCollection( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<NAME>', // name + ["read("any")"], // permissions (optional) + false, // documentSecurity (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..664da19de2 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-datetime-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createDatetimeAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-document.md b/docs/examples/1.7.x/server-deno/examples/databases/create-document.md new file mode 100644 index 0000000000..f18b4f30dc --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-document.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setKey('<YOUR_API_KEY>') // Your secret API key + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +const databases = new Databases(client); + +const response = await databases.createDocument( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<DOCUMENT_ID>', // documentId + {}, // data + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-documents.md b/docs/examples/1.7.x/server-deno/examples/databases/create-documents.md new file mode 100644 index 0000000000..f5e320e193 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-documents.md @@ -0,0 +1,13 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // documents +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..6c667ed38a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-email-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createEmailAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + 'email@example.com', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..6fdd2773c8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-enum-attribute.md @@ -0,0 +1,18 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createEnumAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + [], // elements + false, // required + '<DEFAULT>', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..c5991d49f6 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-float-attribute.md @@ -0,0 +1,19 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createFloatAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + null, // min (optional) + null, // max (optional) + null, // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-index.md b/docs/examples/1.7.x/server-deno/examples/databases/create-index.md new file mode 100644 index 0000000000..3ab3c7a3aa --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-index.md @@ -0,0 +1,18 @@ +import { Client, Databases, IndexType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createIndex( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + IndexType.Key, // type + [], // attributes + [], // orders (optional) + [] // lengths (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..4a306cd50d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-integer-attribute.md @@ -0,0 +1,19 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createIntegerAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + null, // min (optional) + null, // max (optional) + null, // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..c043b25207 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-ip-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createIpAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..d96ee59a4d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-relationship-attribute.md @@ -0,0 +1,19 @@ +import { Client, Databases, RelationshipType, RelationMutate } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createRelationshipAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<RELATED_COLLECTION_ID>', // relatedCollectionId + RelationshipType.OneToOne, // type + false, // twoWay (optional) + '', // key (optional) + '', // twoWayKey (optional) + RelationMutate.Cascade // onDelete (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..5f8e955541 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-string-attribute.md @@ -0,0 +1,19 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createStringAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + 1, // size + false, // required + '<DEFAULT>', // default (optional) + false, // array (optional) + false // encrypt (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..4639f75f5b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create-url-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.createUrlAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + 'https://example.com', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/create.md b/docs/examples/1.7.x/server-deno/examples/databases/create.md new file mode 100644 index 0000000000..86795eb750 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/create.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.create( + '<DATABASE_ID>', // databaseId + '<NAME>', // name + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..f7ad6b105a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/delete-attribute.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.deleteAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '' // key +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-deno/examples/databases/delete-collection.md new file mode 100644 index 0000000000..828d48a7bc --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/delete-collection.md @@ -0,0 +1,13 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.deleteCollection( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>' // collectionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/delete-document.md b/docs/examples/1.7.x/server-deno/examples/databases/delete-document.md new file mode 100644 index 0000000000..47d5df49f1 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/delete-document.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new Databases(client); + +const response = await databases.deleteDocument( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<DOCUMENT_ID>' // documentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-deno/examples/databases/delete-documents.md new file mode 100644 index 0000000000..4768ed426b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/delete-documents.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.deleteDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/delete-index.md b/docs/examples/1.7.x/server-deno/examples/databases/delete-index.md new file mode 100644 index 0000000000..eee1613a87 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/delete-index.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.deleteIndex( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '' // key +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/delete.md b/docs/examples/1.7.x/server-deno/examples/databases/delete.md new file mode 100644 index 0000000000..39b3f5395e --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/delete.md @@ -0,0 +1,12 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.delete( + '<DATABASE_ID>' // databaseId +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/get-attribute.md new file mode 100644 index 0000000000..f2b801b5f1 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/get-attribute.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.getAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '' // key +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/get-collection.md b/docs/examples/1.7.x/server-deno/examples/databases/get-collection.md new file mode 100644 index 0000000000..b94f4fd5ff --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/get-collection.md @@ -0,0 +1,13 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.getCollection( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>' // collectionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/get-document.md b/docs/examples/1.7.x/server-deno/examples/databases/get-document.md new file mode 100644 index 0000000000..5cb02c4de3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/get-document.md @@ -0,0 +1,15 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new Databases(client); + +const response = await databases.getDocument( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<DOCUMENT_ID>', // documentId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/get-index.md b/docs/examples/1.7.x/server-deno/examples/databases/get-index.md new file mode 100644 index 0000000000..6c3a3dec1a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/get-index.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.getIndex( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '' // key +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/get.md b/docs/examples/1.7.x/server-deno/examples/databases/get.md new file mode 100644 index 0000000000..403e467e04 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/get.md @@ -0,0 +1,12 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.get( + '<DATABASE_ID>' // databaseId +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-deno/examples/databases/list-attributes.md new file mode 100644 index 0000000000..2171ffe4ad --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/list-attributes.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.listAttributes( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/list-collections.md b/docs/examples/1.7.x/server-deno/examples/databases/list-collections.md new file mode 100644 index 0000000000..408ea2d601 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/list-collections.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.listCollections( + '<DATABASE_ID>', // databaseId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/list-documents.md b/docs/examples/1.7.x/server-deno/examples/databases/list-documents.md new file mode 100644 index 0000000000..528e979517 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/list-documents.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new Databases(client); + +const response = await databases.listDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-deno/examples/databases/list-indexes.md new file mode 100644 index 0000000000..88af3b7f28 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/list-indexes.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.listIndexes( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/list.md b/docs/examples/1.7.x/server-deno/examples/databases/list.md new file mode 100644 index 0000000000..dcae151617 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/list.md @@ -0,0 +1,13 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..fe1b80073a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-boolean-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateBooleanAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + false, // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-collection.md b/docs/examples/1.7.x/server-deno/examples/databases/update-collection.md new file mode 100644 index 0000000000..47f1c02783 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-collection.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateCollection( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<NAME>', // name + ["read("any")"], // permissions (optional) + false, // documentSecurity (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..ad18d93865 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-datetime-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateDatetimeAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-document.md b/docs/examples/1.7.x/server-deno/examples/databases/update-document.md new file mode 100644 index 0000000000..31cce5ed1c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-document.md @@ -0,0 +1,16 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new Databases(client); + +const response = await databases.updateDocument( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<DOCUMENT_ID>', // documentId + {}, // data (optional) + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-documents.md b/docs/examples/1.7.x/server-deno/examples/databases/update-documents.md new file mode 100644 index 0000000000..1eef7794fb --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-documents.md @@ -0,0 +1,15 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + {}, // data (optional) + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..116fadc6c7 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-email-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateEmailAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + 'email@example.com', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..663e44b530 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-enum-attribute.md @@ -0,0 +1,18 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateEnumAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + [], // elements + false, // required + '<DEFAULT>', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..d9eab5aac5 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-float-attribute.md @@ -0,0 +1,19 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateFloatAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + null, // default + null, // min (optional) + null, // max (optional) + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..369b49d574 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-integer-attribute.md @@ -0,0 +1,19 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateIntegerAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + null, // default + null, // min (optional) + null, // max (optional) + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..049a527993 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-ip-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateIpAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..7fae26b535 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-relationship-attribute.md @@ -0,0 +1,16 @@ +import { Client, Databases, RelationMutate } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateRelationshipAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + RelationMutate.Cascade, // onDelete (optional) + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..ec91d3367e --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-string-attribute.md @@ -0,0 +1,18 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateStringAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '<DEFAULT>', // default + 1, // size (optional) + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-deno/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..32f44b7eaf --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update-url-attribute.md @@ -0,0 +1,17 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.updateUrlAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + 'https://example.com', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/update.md b/docs/examples/1.7.x/server-deno/examples/databases/update.md new file mode 100644 index 0000000000..b87ad82ec0 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/update.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.update( + '<DATABASE_ID>', // databaseId + '<NAME>', // name + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-deno/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..c0ee477875 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/databases/upsert-documents.md @@ -0,0 +1,14 @@ +import { Client, Databases } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new Databases(client); + +const response = await databases.upsertDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // documents (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-deno/examples/functions/create-deployment.md new file mode 100644 index 0000000000..a134a382fa --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/create-deployment.md @@ -0,0 +1,16 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.createDeployment( + '<FUNCTION_ID>', // functionId + InputFile.fromPath('/path/to/file.png', 'file.png'), // code + false, // activate + '<ENTRYPOINT>', // entrypoint (optional) + '<COMMANDS>' // commands (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-deno/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..e22d1da72a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,14 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.createDuplicateDeployment( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>', // deploymentId + '<BUILD_ID>' // buildId (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/create-execution.md b/docs/examples/1.7.x/server-deno/examples/functions/create-execution.md new file mode 100644 index 0000000000..bec6a17db2 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/create-execution.md @@ -0,0 +1,18 @@ +import { Client, Functions, ExecutionMethod } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const functions = new Functions(client); + +const response = await functions.createExecution( + '<FUNCTION_ID>', // functionId + '<BODY>', // body (optional) + false, // async (optional) + '<PATH>', // path (optional) + ExecutionMethod.GET, // method (optional) + {}, // headers (optional) + '' // scheduledAt (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-deno/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..69503da6a9 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/create-template-deployment.md @@ -0,0 +1,17 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.createTemplateDeployment( + '<FUNCTION_ID>', // functionId + '<REPOSITORY>', // repository + '<OWNER>', // owner + '<ROOT_DIRECTORY>', // rootDirectory + '<VERSION>', // version + false // activate (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/create-variable.md b/docs/examples/1.7.x/server-deno/examples/functions/create-variable.md new file mode 100644 index 0000000000..28648901ee --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/create-variable.md @@ -0,0 +1,15 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.createVariable( + '<FUNCTION_ID>', // functionId + '<KEY>', // key + '<VALUE>', // value + false // secret (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-deno/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..d501b0ee26 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/create-vcs-deployment.md @@ -0,0 +1,15 @@ +import { Client, Functions, VCSDeploymentType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.createVcsDeployment( + '<FUNCTION_ID>', // functionId + VCSDeploymentType.Branch, // type + '<REFERENCE>', // reference + false // activate (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/create.md b/docs/examples/1.7.x/server-deno/examples/functions/create.md new file mode 100644 index 0000000000..32265deb0b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/create.md @@ -0,0 +1,29 @@ +import { Client, Functions, } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.create( + '<FUNCTION_ID>', // functionId + '<NAME>', // name + .Node145, // runtime + ["any"], // execute (optional) + [], // events (optional) + '', // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + '<ENTRYPOINT>', // entrypoint (optional) + '<COMMANDS>', // commands (optional) + [], // scopes (optional) + '<INSTALLATION_ID>', // installationId (optional) + '<PROVIDER_REPOSITORY_ID>', // providerRepositoryId (optional) + '<PROVIDER_BRANCH>', // providerBranch (optional) + false, // providerSilentMode (optional) + '<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional) + '' // specification (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-deno/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..179bbaf303 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/delete-deployment.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.deleteDeployment( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-deno/examples/functions/delete-execution.md new file mode 100644 index 0000000000..4ab7c37785 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/delete-execution.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.deleteExecution( + '<FUNCTION_ID>', // functionId + '<EXECUTION_ID>' // executionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-deno/examples/functions/delete-variable.md new file mode 100644 index 0000000000..39a9428ed3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/delete-variable.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.deleteVariable( + '<FUNCTION_ID>', // functionId + '<VARIABLE_ID>' // variableId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/delete.md b/docs/examples/1.7.x/server-deno/examples/functions/delete.md new file mode 100644 index 0000000000..94d58c33dd --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/delete.md @@ -0,0 +1,12 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.delete( + '<FUNCTION_ID>' // functionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-deno/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..d153036c9a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/get-deployment-download.md @@ -0,0 +1,14 @@ +import { Client, Functions, DeploymentDownloadType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const result = functions.getDeploymentDownload( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>', // deploymentId + DeploymentDownloadType.Source // type (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-deno/examples/functions/get-deployment.md new file mode 100644 index 0000000000..339b99d4f1 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/get-deployment.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.getDeployment( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/get-execution.md b/docs/examples/1.7.x/server-deno/examples/functions/get-execution.md new file mode 100644 index 0000000000..adeff0256a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/get-execution.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const functions = new Functions(client); + +const response = await functions.getExecution( + '<FUNCTION_ID>', // functionId + '<EXECUTION_ID>' // executionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/get-variable.md b/docs/examples/1.7.x/server-deno/examples/functions/get-variable.md new file mode 100644 index 0000000000..cbbdd2f847 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/get-variable.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.getVariable( + '<FUNCTION_ID>', // functionId + '<VARIABLE_ID>' // variableId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/get.md b/docs/examples/1.7.x/server-deno/examples/functions/get.md new file mode 100644 index 0000000000..8fec17ed15 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/get.md @@ -0,0 +1,12 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.get( + '<FUNCTION_ID>' // functionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-deno/examples/functions/list-deployments.md new file mode 100644 index 0000000000..849fe232b8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/list-deployments.md @@ -0,0 +1,14 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.listDeployments( + '<FUNCTION_ID>', // functionId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/list-executions.md b/docs/examples/1.7.x/server-deno/examples/functions/list-executions.md new file mode 100644 index 0000000000..cd597fb7a5 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/list-executions.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const functions = new Functions(client); + +const response = await functions.listExecutions( + '<FUNCTION_ID>', // functionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-deno/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..a45afe4aa7 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/list-runtimes.md @@ -0,0 +1,10 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.listRuntimes(); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-deno/examples/functions/list-specifications.md new file mode 100644 index 0000000000..3bf0d08e7c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/list-specifications.md @@ -0,0 +1,10 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.listSpecifications(); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/list-variables.md b/docs/examples/1.7.x/server-deno/examples/functions/list-variables.md new file mode 100644 index 0000000000..173d5aa9ef --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/list-variables.md @@ -0,0 +1,12 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.listVariables( + '<FUNCTION_ID>' // functionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/list.md b/docs/examples/1.7.x/server-deno/examples/functions/list.md new file mode 100644 index 0000000000..ecc43d1a7c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/list.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-deno/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..4c7e8052c1 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/update-deployment-status.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.updateDeploymentStatus( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-deno/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..55196c148d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/update-function-deployment.md @@ -0,0 +1,13 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.updateFunctionDeployment( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/update-variable.md b/docs/examples/1.7.x/server-deno/examples/functions/update-variable.md new file mode 100644 index 0000000000..3da706d5f4 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/update-variable.md @@ -0,0 +1,16 @@ +import { Client, Functions } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.updateVariable( + '<FUNCTION_ID>', // functionId + '<VARIABLE_ID>', // variableId + '<KEY>', // key + '<VALUE>', // value (optional) + false // secret (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/functions/update.md b/docs/examples/1.7.x/server-deno/examples/functions/update.md new file mode 100644 index 0000000000..399af05841 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/functions/update.md @@ -0,0 +1,29 @@ +import { Client, Functions, } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new Functions(client); + +const response = await functions.update( + '<FUNCTION_ID>', // functionId + '<NAME>', // name + .Node145, // runtime (optional) + ["any"], // execute (optional) + [], // events (optional) + '', // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + '<ENTRYPOINT>', // entrypoint (optional) + '<COMMANDS>', // commands (optional) + [], // scopes (optional) + '<INSTALLATION_ID>', // installationId (optional) + '<PROVIDER_REPOSITORY_ID>', // providerRepositoryId (optional) + '<PROVIDER_BRANCH>', // providerBranch (optional) + false, // providerSilentMode (optional) + '<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional) + '' // specification (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/graphql/mutation.md b/docs/examples/1.7.x/server-deno/examples/graphql/mutation.md new file mode 100644 index 0000000000..200120f1e8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/graphql/mutation.md @@ -0,0 +1,12 @@ +import { Client, Graphql } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const graphql = new Graphql(client); + +const response = await graphql.mutation( + {} // query +); diff --git a/docs/examples/1.7.x/server-deno/examples/graphql/query.md b/docs/examples/1.7.x/server-deno/examples/graphql/query.md new file mode 100644 index 0000000000..bb0116278c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/graphql/query.md @@ -0,0 +1,12 @@ +import { Client, Graphql } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const graphql = new Graphql(client); + +const response = await graphql.query( + {} // query +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-deno/examples/health/get-antivirus.md new file mode 100644 index 0000000000..d8dcc1fe3a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-antivirus.md @@ -0,0 +1,10 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getAntivirus(); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-cache.md b/docs/examples/1.7.x/server-deno/examples/health/get-cache.md new file mode 100644 index 0000000000..e138b50b26 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-cache.md @@ -0,0 +1,10 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getCache(); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-certificate.md b/docs/examples/1.7.x/server-deno/examples/health/get-certificate.md new file mode 100644 index 0000000000..828e53dd7b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-certificate.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getCertificate( + '' // domain (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-d-b.md b/docs/examples/1.7.x/server-deno/examples/health/get-d-b.md new file mode 100644 index 0000000000..bded9eb81b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-d-b.md @@ -0,0 +1,10 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getDB(); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-deno/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..5e40f762e4 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-failed-jobs.md @@ -0,0 +1,13 @@ +import { Client, Health, } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getFailedJobs( + .V1Database, // name + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-deno/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..ecc05a3e21 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-pub-sub.md @@ -0,0 +1,10 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getPubSub(); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..f6b9388bb3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-builds.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueBuilds( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..e783fa52b3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-certificates.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueCertificates( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..e33c7a2929 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-databases.md @@ -0,0 +1,13 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueDatabases( + '<NAME>', // name (optional) + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..ea7da5b587 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-deletes.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueDeletes( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..e075a65602 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-functions.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueFunctions( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..eb7ffb028a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-logs.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueLogs( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..d9f61bc088 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-mails.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueMails( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..8bc76398d9 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-messaging.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueMessaging( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..e6f7bf543c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-migrations.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueMigrations( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..ecc7ebd322 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-stats-resources.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueStatsResources( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..46aa4db5be --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-usage.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueUsage( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-deno/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..75a1c1f833 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-queue-webhooks.md @@ -0,0 +1,12 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getQueueWebhooks( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-deno/examples/health/get-storage-local.md new file mode 100644 index 0000000000..0e64e1a6dd --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-storage-local.md @@ -0,0 +1,10 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getStorageLocal(); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-storage.md b/docs/examples/1.7.x/server-deno/examples/health/get-storage.md new file mode 100644 index 0000000000..698e33b999 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-storage.md @@ -0,0 +1,10 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getStorage(); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get-time.md b/docs/examples/1.7.x/server-deno/examples/health/get-time.md new file mode 100644 index 0000000000..1bb1ae0e56 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get-time.md @@ -0,0 +1,10 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.getTime(); diff --git a/docs/examples/1.7.x/server-deno/examples/health/get.md b/docs/examples/1.7.x/server-deno/examples/health/get.md new file mode 100644 index 0000000000..87d7ea5396 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/health/get.md @@ -0,0 +1,10 @@ +import { Client, Health } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new Health(client); + +const response = await health.get(); diff --git a/docs/examples/1.7.x/server-deno/examples/locale/get.md b/docs/examples/1.7.x/server-deno/examples/locale/get.md new file mode 100644 index 0000000000..960ee6f4f3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/locale/get.md @@ -0,0 +1,10 @@ +import { Client, Locale } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new Locale(client); + +const response = await locale.get(); diff --git a/docs/examples/1.7.x/server-deno/examples/locale/list-codes.md b/docs/examples/1.7.x/server-deno/examples/locale/list-codes.md new file mode 100644 index 0000000000..8f91c212df --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/locale/list-codes.md @@ -0,0 +1,10 @@ +import { Client, Locale } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new Locale(client); + +const response = await locale.listCodes(); diff --git a/docs/examples/1.7.x/server-deno/examples/locale/list-continents.md b/docs/examples/1.7.x/server-deno/examples/locale/list-continents.md new file mode 100644 index 0000000000..55b208c741 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/locale/list-continents.md @@ -0,0 +1,10 @@ +import { Client, Locale } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new Locale(client); + +const response = await locale.listContinents(); diff --git a/docs/examples/1.7.x/server-deno/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-deno/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..b4fbfa0e37 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/locale/list-countries-e-u.md @@ -0,0 +1,10 @@ +import { Client, Locale } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new Locale(client); + +const response = await locale.listCountriesEU(); diff --git a/docs/examples/1.7.x/server-deno/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-deno/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..19ac0a06cf --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/locale/list-countries-phones.md @@ -0,0 +1,10 @@ +import { Client, Locale } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new Locale(client); + +const response = await locale.listCountriesPhones(); diff --git a/docs/examples/1.7.x/server-deno/examples/locale/list-countries.md b/docs/examples/1.7.x/server-deno/examples/locale/list-countries.md new file mode 100644 index 0000000000..67ba0fedd7 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/locale/list-countries.md @@ -0,0 +1,10 @@ +import { Client, Locale } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new Locale(client); + +const response = await locale.listCountries(); diff --git a/docs/examples/1.7.x/server-deno/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-deno/examples/locale/list-currencies.md new file mode 100644 index 0000000000..986f09d237 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/locale/list-currencies.md @@ -0,0 +1,10 @@ +import { Client, Locale } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new Locale(client); + +const response = await locale.listCurrencies(); diff --git a/docs/examples/1.7.x/server-deno/examples/locale/list-languages.md b/docs/examples/1.7.x/server-deno/examples/locale/list-languages.md new file mode 100644 index 0000000000..91b4a857b9 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/locale/list-languages.md @@ -0,0 +1,10 @@ +import { Client, Locale } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new Locale(client); + +const response = await locale.listLanguages(); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..e2c33feff8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-apns-provider.md @@ -0,0 +1,19 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createApnsProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<AUTH_KEY>', // authKey (optional) + '<AUTH_KEY_ID>', // authKeyId (optional) + '<TEAM_ID>', // teamId (optional) + '<BUNDLE_ID>', // bundleId (optional) + false, // sandbox (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-email.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-email.md new file mode 100644 index 0000000000..8db2879f9c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-email.md @@ -0,0 +1,23 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createEmail( + '<MESSAGE_ID>', // messageId + '<SUBJECT>', // subject + '<CONTENT>', // content + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + [], // cc (optional) + [], // bcc (optional) + [], // attachments (optional) + false, // draft (optional) + false, // html (optional) + '' // scheduledAt (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..3f443d6bf5 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-fcm-provider.md @@ -0,0 +1,15 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createFcmProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + {}, // serviceAccountJSON (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..32f7c94f21 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,21 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createMailgunProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<API_KEY>', // apiKey (optional) + '<DOMAIN>', // domain (optional) + false, // isEuRegion (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + 'email@example.com', // replyToEmail (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..57e94188b9 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-msg91provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createMsg91Provider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<TEMPLATE_ID>', // templateId (optional) + '<SENDER_ID>', // senderId (optional) + '<AUTH_KEY>', // authKey (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-push.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-push.md new file mode 100644 index 0000000000..7523c2978f --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-push.md @@ -0,0 +1,30 @@ +import { Client, Messaging, MessagePriority } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createPush( + '<MESSAGE_ID>', // messageId + '<TITLE>', // title (optional) + '<BODY>', // body (optional) + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + {}, // data (optional) + '<ACTION>', // action (optional) + '[ID1:ID2]', // image (optional) + '<ICON>', // icon (optional) + '<SOUND>', // sound (optional) + '<COLOR>', // color (optional) + '<TAG>', // tag (optional) + null, // badge (optional) + false, // draft (optional) + '', // scheduledAt (optional) + false, // contentAvailable (optional) + false, // critical (optional) + MessagePriority.Normal // priority (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..15fe7b8c7b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,19 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createSendgridProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<API_KEY>', // apiKey (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + 'email@example.com', // replyToEmail (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-sms.md new file mode 100644 index 0000000000..264203a8be --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-sms.md @@ -0,0 +1,18 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createSms( + '<MESSAGE_ID>', // messageId + '<CONTENT>', // content + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + false, // draft (optional) + '' // scheduledAt (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..2d6d33c62a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-smtp-provider.md @@ -0,0 +1,25 @@ +import { Client, Messaging, SmtpEncryption } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createSmtpProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<HOST>', // host + 1, // port (optional) + '<USERNAME>', // username (optional) + '<PASSWORD>', // password (optional) + SmtpEncryption.None, // encryption (optional) + false, // autoTLS (optional) + '<MAILER>', // mailer (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + 'email@example.com', // replyToEmail (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..8be79f3f9e --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-subscriber.md @@ -0,0 +1,14 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +const messaging = new Messaging(client); + +const response = await messaging.createSubscriber( + '<TOPIC_ID>', // topicId + '<SUBSCRIBER_ID>', // subscriberId + '<TARGET_ID>' // targetId +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..2bb95c4e2d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-telesign-provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createTelesignProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '+12065550100', // from (optional) + '<CUSTOMER_ID>', // customerId (optional) + '<API_KEY>', // apiKey (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..4657493664 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createTextmagicProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '+12065550100', // from (optional) + '<USERNAME>', // username (optional) + '<API_KEY>', // apiKey (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-topic.md new file mode 100644 index 0000000000..c2ca3a4ed2 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-topic.md @@ -0,0 +1,14 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createTopic( + '<TOPIC_ID>', // topicId + '<NAME>', // name + ["any"] // subscribe (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..aa7bbf6a18 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-twilio-provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createTwilioProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '+12065550100', // from (optional) + '<ACCOUNT_SID>', // accountSid (optional) + '<AUTH_TOKEN>', // authToken (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..5fe734fb0c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/create-vonage-provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.createVonageProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '+12065550100', // from (optional) + '<API_KEY>', // apiKey (optional) + '<API_SECRET>', // apiSecret (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..7bc99ef3b5 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/delete-provider.md @@ -0,0 +1,12 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.deleteProvider( + '<PROVIDER_ID>' // providerId +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-deno/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..147456887d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/delete-subscriber.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +const messaging = new Messaging(client); + +const response = await messaging.deleteSubscriber( + '<TOPIC_ID>', // topicId + '<SUBSCRIBER_ID>' // subscriberId +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-deno/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..aa1359cf28 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/delete-topic.md @@ -0,0 +1,12 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.deleteTopic( + '<TOPIC_ID>' // topicId +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/delete.md b/docs/examples/1.7.x/server-deno/examples/messaging/delete.md new file mode 100644 index 0000000000..0442da1e8b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/delete.md @@ -0,0 +1,12 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.delete( + '<MESSAGE_ID>' // messageId +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/get-message.md b/docs/examples/1.7.x/server-deno/examples/messaging/get-message.md new file mode 100644 index 0000000000..9565a611ae --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/get-message.md @@ -0,0 +1,12 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.getMessage( + '<MESSAGE_ID>' // messageId +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/get-provider.md new file mode 100644 index 0000000000..8e5d426418 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/get-provider.md @@ -0,0 +1,12 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.getProvider( + '<PROVIDER_ID>' // providerId +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-deno/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..e9377a532f --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/get-subscriber.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.getSubscriber( + '<TOPIC_ID>', // topicId + '<SUBSCRIBER_ID>' // subscriberId +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-deno/examples/messaging/get-topic.md new file mode 100644 index 0000000000..35f1853ada --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/get-topic.md @@ -0,0 +1,12 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.getTopic( + '<TOPIC_ID>' // topicId +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-deno/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..f39a90037a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/list-message-logs.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.listMessageLogs( + '<MESSAGE_ID>', // messageId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-deno/examples/messaging/list-messages.md new file mode 100644 index 0000000000..50b1a10f4b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/list-messages.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.listMessages( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-deno/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..c4b20a8306 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/list-provider-logs.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.listProviderLogs( + '<PROVIDER_ID>', // providerId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-deno/examples/messaging/list-providers.md new file mode 100644 index 0000000000..7c877c25de --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/list-providers.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.listProviders( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-deno/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..0d14f85777 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.listSubscriberLogs( + '<SUBSCRIBER_ID>', // subscriberId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-deno/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..384bb8fe4f --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/list-subscribers.md @@ -0,0 +1,14 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.listSubscribers( + '<TOPIC_ID>', // topicId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-deno/examples/messaging/list-targets.md new file mode 100644 index 0000000000..5ce2082236 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/list-targets.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.listTargets( + '<MESSAGE_ID>', // messageId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-deno/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..d2c771d480 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/list-topic-logs.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.listTopicLogs( + '<TOPIC_ID>', // topicId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-deno/examples/messaging/list-topics.md new file mode 100644 index 0000000000..1d0ec43066 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/list-topics.md @@ -0,0 +1,13 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.listTopics( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..71bd038edb --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-apns-provider.md @@ -0,0 +1,19 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateApnsProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<AUTH_KEY>', // authKey (optional) + '<AUTH_KEY_ID>', // authKeyId (optional) + '<TEAM_ID>', // teamId (optional) + '<BUNDLE_ID>', // bundleId (optional) + false // sandbox (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-email.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-email.md new file mode 100644 index 0000000000..c8b0558250 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-email.md @@ -0,0 +1,23 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateEmail( + '<MESSAGE_ID>', // messageId + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + '<SUBJECT>', // subject (optional) + '<CONTENT>', // content (optional) + false, // draft (optional) + false, // html (optional) + [], // cc (optional) + [], // bcc (optional) + '', // scheduledAt (optional) + [] // attachments (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..eb71dddd1a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-fcm-provider.md @@ -0,0 +1,15 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateFcmProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + {} // serviceAccountJSON (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..f80d6a4b1d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,21 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateMailgunProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + '<API_KEY>', // apiKey (optional) + '<DOMAIN>', // domain (optional) + false, // isEuRegion (optional) + false, // enabled (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + '<REPLY_TO_EMAIL>' // replyToEmail (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..36943f2fa0 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-msg91provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateMsg91Provider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<TEMPLATE_ID>', // templateId (optional) + '<SENDER_ID>', // senderId (optional) + '<AUTH_KEY>' // authKey (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-push.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-push.md new file mode 100644 index 0000000000..c7f068604b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-push.md @@ -0,0 +1,30 @@ +import { Client, Messaging, MessagePriority } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updatePush( + '<MESSAGE_ID>', // messageId + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + '<TITLE>', // title (optional) + '<BODY>', // body (optional) + {}, // data (optional) + '<ACTION>', // action (optional) + '[ID1:ID2]', // image (optional) + '<ICON>', // icon (optional) + '<SOUND>', // sound (optional) + '<COLOR>', // color (optional) + '<TAG>', // tag (optional) + null, // badge (optional) + false, // draft (optional) + '', // scheduledAt (optional) + false, // contentAvailable (optional) + false, // critical (optional) + MessagePriority.Normal // priority (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..0ec96db2f8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,19 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateSendgridProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<API_KEY>', // apiKey (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + '<REPLY_TO_EMAIL>' // replyToEmail (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-sms.md new file mode 100644 index 0000000000..9c1dc4a5dc --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-sms.md @@ -0,0 +1,18 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateSms( + '<MESSAGE_ID>', // messageId + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + '<CONTENT>', // content (optional) + false, // draft (optional) + '' // scheduledAt (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..9d59bb3646 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-smtp-provider.md @@ -0,0 +1,25 @@ +import { Client, Messaging, SmtpEncryption } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateSmtpProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + '<HOST>', // host (optional) + 1, // port (optional) + '<USERNAME>', // username (optional) + '<PASSWORD>', // password (optional) + SmtpEncryption.None, // encryption (optional) + false, // autoTLS (optional) + '<MAILER>', // mailer (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + '<REPLY_TO_EMAIL>', // replyToEmail (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..052d394f05 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-telesign-provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateTelesignProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<CUSTOMER_ID>', // customerId (optional) + '<API_KEY>', // apiKey (optional) + '<FROM>' // from (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..2163792f83 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateTextmagicProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<USERNAME>', // username (optional) + '<API_KEY>', // apiKey (optional) + '<FROM>' // from (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-topic.md new file mode 100644 index 0000000000..5f7f77901b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-topic.md @@ -0,0 +1,14 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateTopic( + '<TOPIC_ID>', // topicId + '<NAME>', // name (optional) + ["any"] // subscribe (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..5abdd65a9c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-twilio-provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateTwilioProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<ACCOUNT_SID>', // accountSid (optional) + '<AUTH_TOKEN>', // authToken (optional) + '<FROM>' // from (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-deno/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..c8fa90d9ab --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/messaging/update-vonage-provider.md @@ -0,0 +1,17 @@ +import { Client, Messaging } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new Messaging(client); + +const response = await messaging.updateVonageProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<API_KEY>', // apiKey (optional) + '<API_SECRET>', // apiSecret (optional) + '<FROM>' // from (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-deno/examples/sites/create-deployment.md new file mode 100644 index 0000000000..f674553a10 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/create-deployment.md @@ -0,0 +1,17 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.createDeployment( + '<SITE_ID>', // siteId + InputFile.fromPath('/path/to/file.png', 'file.png'), // code + false, // activate + '<INSTALL_COMMAND>', // installCommand (optional) + '<BUILD_COMMAND>', // buildCommand (optional) + '<OUTPUT_DIRECTORY>' // outputDirectory (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-deno/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..317e80b312 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.createDuplicateDeployment( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-deno/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..4ef245bd16 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/create-template-deployment.md @@ -0,0 +1,17 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.createTemplateDeployment( + '<SITE_ID>', // siteId + '<REPOSITORY>', // repository + '<OWNER>', // owner + '<ROOT_DIRECTORY>', // rootDirectory + '<VERSION>', // version + false // activate (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/create-variable.md b/docs/examples/1.7.x/server-deno/examples/sites/create-variable.md new file mode 100644 index 0000000000..7b07a088ce --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/create-variable.md @@ -0,0 +1,15 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.createVariable( + '<SITE_ID>', // siteId + '<KEY>', // key + '<VALUE>', // value + false // secret (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-deno/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..5c49808811 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/create-vcs-deployment.md @@ -0,0 +1,15 @@ +import { Client, Sites, VCSDeploymentType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.createVcsDeployment( + '<SITE_ID>', // siteId + VCSDeploymentType.Branch, // type + '<REFERENCE>', // reference + false // activate (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/create.md b/docs/examples/1.7.x/server-deno/examples/sites/create.md new file mode 100644 index 0000000000..420b36290b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/create.md @@ -0,0 +1,29 @@ +import { Client, Sites, , , } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.create( + '<SITE_ID>', // siteId + '<NAME>', // name + .Analog, // framework + .Node145, // buildRuntime + false, // enabled (optional) + false, // logging (optional) + 1, // timeout (optional) + '<INSTALL_COMMAND>', // installCommand (optional) + '<BUILD_COMMAND>', // buildCommand (optional) + '<OUTPUT_DIRECTORY>', // outputDirectory (optional) + .Static, // adapter (optional) + '<INSTALLATION_ID>', // installationId (optional) + '<FALLBACK_FILE>', // fallbackFile (optional) + '<PROVIDER_REPOSITORY_ID>', // providerRepositoryId (optional) + '<PROVIDER_BRANCH>', // providerBranch (optional) + false, // providerSilentMode (optional) + '<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional) + '' // specification (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-deno/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..cd97673387 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/delete-deployment.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.deleteDeployment( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/delete-log.md b/docs/examples/1.7.x/server-deno/examples/sites/delete-log.md new file mode 100644 index 0000000000..0b70eb30b6 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/delete-log.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.deleteLog( + '<SITE_ID>', // siteId + '<LOG_ID>' // logId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-deno/examples/sites/delete-variable.md new file mode 100644 index 0000000000..0bbc2e33dc --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/delete-variable.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.deleteVariable( + '<SITE_ID>', // siteId + '<VARIABLE_ID>' // variableId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/delete.md b/docs/examples/1.7.x/server-deno/examples/sites/delete.md new file mode 100644 index 0000000000..af5dbed3f2 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/delete.md @@ -0,0 +1,12 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.delete( + '<SITE_ID>' // siteId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-deno/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..4c3ceca8ae --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/get-deployment-download.md @@ -0,0 +1,14 @@ +import { Client, Sites, DeploymentDownloadType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const result = sites.getDeploymentDownload( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>', // deploymentId + DeploymentDownloadType.Source // type (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-deno/examples/sites/get-deployment.md new file mode 100644 index 0000000000..4e614b0de9 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/get-deployment.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.getDeployment( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/get-log.md b/docs/examples/1.7.x/server-deno/examples/sites/get-log.md new file mode 100644 index 0000000000..9495030fa3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/get-log.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.getLog( + '<SITE_ID>', // siteId + '<LOG_ID>' // logId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/get-variable.md b/docs/examples/1.7.x/server-deno/examples/sites/get-variable.md new file mode 100644 index 0000000000..12ab553026 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/get-variable.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.getVariable( + '<SITE_ID>', // siteId + '<VARIABLE_ID>' // variableId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/get.md b/docs/examples/1.7.x/server-deno/examples/sites/get.md new file mode 100644 index 0000000000..769f426d1e --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/get.md @@ -0,0 +1,12 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.get( + '<SITE_ID>' // siteId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-deno/examples/sites/list-deployments.md new file mode 100644 index 0000000000..09cc52194f --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/list-deployments.md @@ -0,0 +1,14 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.listDeployments( + '<SITE_ID>', // siteId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-deno/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..5623960463 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/list-frameworks.md @@ -0,0 +1,10 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.listFrameworks(); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/list-logs.md b/docs/examples/1.7.x/server-deno/examples/sites/list-logs.md new file mode 100644 index 0000000000..3249903c07 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/list-logs.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.listLogs( + '<SITE_ID>', // siteId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-deno/examples/sites/list-specifications.md new file mode 100644 index 0000000000..a1b0b334ed --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/list-specifications.md @@ -0,0 +1,10 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.listSpecifications(); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/list-variables.md b/docs/examples/1.7.x/server-deno/examples/sites/list-variables.md new file mode 100644 index 0000000000..0aac319816 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/list-variables.md @@ -0,0 +1,12 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.listVariables( + '<SITE_ID>' // siteId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/list.md b/docs/examples/1.7.x/server-deno/examples/sites/list.md new file mode 100644 index 0000000000..f21433d794 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/list.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-deno/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..83fe6f85a0 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/update-deployment-status.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.updateDeploymentStatus( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-deno/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..1d9d697d39 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/update-site-deployment.md @@ -0,0 +1,13 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.updateSiteDeployment( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/update-variable.md b/docs/examples/1.7.x/server-deno/examples/sites/update-variable.md new file mode 100644 index 0000000000..6776af7a65 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/update-variable.md @@ -0,0 +1,16 @@ +import { Client, Sites } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.updateVariable( + '<SITE_ID>', // siteId + '<VARIABLE_ID>', // variableId + '<KEY>', // key + '<VALUE>', // value (optional) + false // secret (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/sites/update.md b/docs/examples/1.7.x/server-deno/examples/sites/update.md new file mode 100644 index 0000000000..ba7d195cd3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/sites/update.md @@ -0,0 +1,29 @@ +import { Client, Sites, , , } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new Sites(client); + +const response = await sites.update( + '<SITE_ID>', // siteId + '<NAME>', // name + .Analog, // framework + false, // enabled (optional) + false, // logging (optional) + 1, // timeout (optional) + '<INSTALL_COMMAND>', // installCommand (optional) + '<BUILD_COMMAND>', // buildCommand (optional) + '<OUTPUT_DIRECTORY>', // outputDirectory (optional) + .Node145, // buildRuntime (optional) + .Static, // adapter (optional) + '<FALLBACK_FILE>', // fallbackFile (optional) + '<INSTALLATION_ID>', // installationId (optional) + '<PROVIDER_REPOSITORY_ID>', // providerRepositoryId (optional) + '<PROVIDER_BRANCH>', // providerBranch (optional) + false, // providerSilentMode (optional) + '<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional) + '' // specification (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-deno/examples/storage/create-bucket.md new file mode 100644 index 0000000000..e7d3e9006a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/create-bucket.md @@ -0,0 +1,21 @@ +import { Client, Storage, } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const response = await storage.createBucket( + '<BUCKET_ID>', // bucketId + '<NAME>', // name + ["read("any")"], // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + [], // allowedFileExtensions (optional) + .None, // compression (optional) + false, // encryption (optional) + false // antivirus (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/create-file.md b/docs/examples/1.7.x/server-deno/examples/storage/create-file.md new file mode 100644 index 0000000000..d8912c6c1e --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/create-file.md @@ -0,0 +1,15 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new Storage(client); + +const response = await storage.createFile( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + InputFile.fromPath('/path/to/file.png', 'file.png'), // file + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-deno/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..f0d71467d4 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/delete-bucket.md @@ -0,0 +1,12 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const response = await storage.deleteBucket( + '<BUCKET_ID>' // bucketId +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/delete-file.md b/docs/examples/1.7.x/server-deno/examples/storage/delete-file.md new file mode 100644 index 0000000000..2a1f95ed18 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/delete-file.md @@ -0,0 +1,13 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new Storage(client); + +const response = await storage.deleteFile( + '<BUCKET_ID>', // bucketId + '<FILE_ID>' // fileId +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-deno/examples/storage/get-bucket.md new file mode 100644 index 0000000000..a695021b72 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/get-bucket.md @@ -0,0 +1,12 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const response = await storage.getBucket( + '<BUCKET_ID>' // bucketId +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-deno/examples/storage/get-file-download.md new file mode 100644 index 0000000000..df11f40b80 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/get-file-download.md @@ -0,0 +1,14 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new Storage(client); + +const result = storage.getFileDownload( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + '<TOKEN>' // token (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-deno/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..6457c7831b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/get-file-preview.md @@ -0,0 +1,25 @@ +import { Client, Storage, ImageGravity, ImageFormat } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new Storage(client); + +const result = storage.getFilePreview( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + 0, // width (optional) + 0, // height (optional) + ImageGravity.Center, // gravity (optional) + -1, // quality (optional) + 0, // borderWidth (optional) + '', // borderColor (optional) + 0, // borderRadius (optional) + 0, // opacity (optional) + -360, // rotation (optional) + '', // background (optional) + ImageFormat.Jpg, // output (optional) + '<TOKEN>' // token (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-deno/examples/storage/get-file-view.md new file mode 100644 index 0000000000..5a1dbac86a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/get-file-view.md @@ -0,0 +1,14 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new Storage(client); + +const result = storage.getFileView( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + '<TOKEN>' // token (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/get-file.md b/docs/examples/1.7.x/server-deno/examples/storage/get-file.md new file mode 100644 index 0000000000..5479dc569d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/get-file.md @@ -0,0 +1,13 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new Storage(client); + +const response = await storage.getFile( + '<BUCKET_ID>', // bucketId + '<FILE_ID>' // fileId +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-deno/examples/storage/list-buckets.md new file mode 100644 index 0000000000..9286bd488c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/list-buckets.md @@ -0,0 +1,13 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const response = await storage.listBuckets( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/list-files.md b/docs/examples/1.7.x/server-deno/examples/storage/list-files.md new file mode 100644 index 0000000000..316875cf51 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/list-files.md @@ -0,0 +1,14 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new Storage(client); + +const response = await storage.listFiles( + '<BUCKET_ID>', // bucketId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-deno/examples/storage/update-bucket.md new file mode 100644 index 0000000000..1e70f16ef3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/update-bucket.md @@ -0,0 +1,21 @@ +import { Client, Storage, } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new Storage(client); + +const response = await storage.updateBucket( + '<BUCKET_ID>', // bucketId + '<NAME>', // name + ["read("any")"], // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + [], // allowedFileExtensions (optional) + .None, // compression (optional) + false, // encryption (optional) + false // antivirus (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/storage/update-file.md b/docs/examples/1.7.x/server-deno/examples/storage/update-file.md new file mode 100644 index 0000000000..683b0b7304 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/storage/update-file.md @@ -0,0 +1,15 @@ +import { Client, Storage } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new Storage(client); + +const response = await storage.updateFile( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + '<NAME>', // name (optional) + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/create-membership.md b/docs/examples/1.7.x/server-deno/examples/teams/create-membership.md new file mode 100644 index 0000000000..d8e855f852 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/create-membership.md @@ -0,0 +1,18 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.createMembership( + '<TEAM_ID>', // teamId + [], // roles + 'email@example.com', // email (optional) + '<USER_ID>', // userId (optional) + '+12065550100', // phone (optional) + 'https://example.com', // url (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/create.md b/docs/examples/1.7.x/server-deno/examples/teams/create.md new file mode 100644 index 0000000000..495f26e006 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/create.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.create( + '<TEAM_ID>', // teamId + '<NAME>', // name + [] // roles (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-deno/examples/teams/delete-membership.md new file mode 100644 index 0000000000..a5b03875d5 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/delete-membership.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.deleteMembership( + '<TEAM_ID>', // teamId + '<MEMBERSHIP_ID>' // membershipId +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/delete.md b/docs/examples/1.7.x/server-deno/examples/teams/delete.md new file mode 100644 index 0000000000..556fbb5ea5 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/delete.md @@ -0,0 +1,12 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.delete( + '<TEAM_ID>' // teamId +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/get-membership.md b/docs/examples/1.7.x/server-deno/examples/teams/get-membership.md new file mode 100644 index 0000000000..75283bffc7 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/get-membership.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.getMembership( + '<TEAM_ID>', // teamId + '<MEMBERSHIP_ID>' // membershipId +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-deno/examples/teams/get-prefs.md new file mode 100644 index 0000000000..442d8b139a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/get-prefs.md @@ -0,0 +1,12 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.getPrefs( + '<TEAM_ID>' // teamId +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/get.md b/docs/examples/1.7.x/server-deno/examples/teams/get.md new file mode 100644 index 0000000000..2e5803ca7b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/get.md @@ -0,0 +1,12 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.get( + '<TEAM_ID>' // teamId +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-deno/examples/teams/list-memberships.md new file mode 100644 index 0000000000..0b7e6638e6 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/list-memberships.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.listMemberships( + '<TEAM_ID>', // teamId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/list.md b/docs/examples/1.7.x/server-deno/examples/teams/list.md new file mode 100644 index 0000000000..6c08b5c80a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/list.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-deno/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..48fc9cd8be --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/update-membership-status.md @@ -0,0 +1,15 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.updateMembershipStatus( + '<TEAM_ID>', // teamId + '<MEMBERSHIP_ID>', // membershipId + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/update-membership.md b/docs/examples/1.7.x/server-deno/examples/teams/update-membership.md new file mode 100644 index 0000000000..be8651d724 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/update-membership.md @@ -0,0 +1,14 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.updateMembership( + '<TEAM_ID>', // teamId + '<MEMBERSHIP_ID>', // membershipId + [] // roles +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/update-name.md b/docs/examples/1.7.x/server-deno/examples/teams/update-name.md new file mode 100644 index 0000000000..6e2144b897 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/update-name.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.updateName( + '<TEAM_ID>', // teamId + '<NAME>' // name +); diff --git a/docs/examples/1.7.x/server-deno/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-deno/examples/teams/update-prefs.md new file mode 100644 index 0000000000..dea8a368c4 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/teams/update-prefs.md @@ -0,0 +1,13 @@ +import { Client, Teams } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new Teams(client); + +const response = await teams.updatePrefs( + '<TEAM_ID>', // teamId + {} // prefs +); diff --git a/docs/examples/1.7.x/server-deno/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-deno/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..7c24738cb5 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/tokens/create-file-token.md @@ -0,0 +1,14 @@ +import { Client, Tokens } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const response = await tokens.createFileToken( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + '' // expire (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/tokens/delete.md b/docs/examples/1.7.x/server-deno/examples/tokens/delete.md new file mode 100644 index 0000000000..b5e3adfa35 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/tokens/delete.md @@ -0,0 +1,12 @@ +import { Client, Tokens } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const response = await tokens.delete( + '<TOKEN_ID>' // tokenId +); diff --git a/docs/examples/1.7.x/server-deno/examples/tokens/get.md b/docs/examples/1.7.x/server-deno/examples/tokens/get.md new file mode 100644 index 0000000000..2bb827d870 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/tokens/get.md @@ -0,0 +1,12 @@ +import { Client, Tokens } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const response = await tokens.get( + '<TOKEN_ID>' // tokenId +); diff --git a/docs/examples/1.7.x/server-deno/examples/tokens/list.md b/docs/examples/1.7.x/server-deno/examples/tokens/list.md new file mode 100644 index 0000000000..7208a53553 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/tokens/list.md @@ -0,0 +1,14 @@ +import { Client, Tokens } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const response = await tokens.list( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/tokens/update.md b/docs/examples/1.7.x/server-deno/examples/tokens/update.md new file mode 100644 index 0000000000..4464a0ccf8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/tokens/update.md @@ -0,0 +1,13 @@ +import { Client, Tokens } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new Tokens(client); + +const response = await tokens.update( + '<TOKEN_ID>', // tokenId + '' // expire (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-deno/examples/users/create-argon2user.md new file mode 100644 index 0000000000..7a6e0fb144 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-argon2user.md @@ -0,0 +1,15 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createArgon2User( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-deno/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..ddfb7f3b12 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-bcrypt-user.md @@ -0,0 +1,15 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createBcryptUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-deno/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..4c433aebdd --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-j-w-t.md @@ -0,0 +1,14 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createJWT( + '<USER_ID>', // userId + '<SESSION_ID>', // sessionId (optional) + 0 // duration (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-deno/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..8cc63cedbd --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-m-d5user.md @@ -0,0 +1,15 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createMD5User( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-deno/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..98ba71a845 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createMfaRecoveryCodes( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-deno/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..750b299074 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-p-h-pass-user.md @@ -0,0 +1,15 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createPHPassUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-deno/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..e243a1d6ee --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-s-h-a-user.md @@ -0,0 +1,16 @@ +import { Client, Users, PasswordHash } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createSHAUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + PasswordHash.Sha1, // passwordVersion (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-deno/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..0d6a65b8b4 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,18 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createScryptModifiedUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<PASSWORD_SALT>', // passwordSalt + '<PASSWORD_SALT_SEPARATOR>', // passwordSaltSeparator + '<PASSWORD_SIGNER_KEY>', // passwordSignerKey + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-deno/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..87f2dbb09e --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-scrypt-user.md @@ -0,0 +1,20 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createScryptUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<PASSWORD_SALT>', // passwordSalt + null, // passwordCpu + null, // passwordMemory + null, // passwordParallel + null, // passwordLength + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-session.md b/docs/examples/1.7.x/server-deno/examples/users/create-session.md new file mode 100644 index 0000000000..37d6948942 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-session.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createSession( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-target.md b/docs/examples/1.7.x/server-deno/examples/users/create-target.md new file mode 100644 index 0000000000..a36072a5de --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-target.md @@ -0,0 +1,17 @@ +import { Client, Users, MessagingProviderType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createTarget( + '<USER_ID>', // userId + '<TARGET_ID>', // targetId + MessagingProviderType.Email, // providerType + '<IDENTIFIER>', // identifier + '<PROVIDER_ID>', // providerId (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create-token.md b/docs/examples/1.7.x/server-deno/examples/users/create-token.md new file mode 100644 index 0000000000..91885e15f3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create-token.md @@ -0,0 +1,14 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.createToken( + '<USER_ID>', // userId + 4, // length (optional) + 60 // expire (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/create.md b/docs/examples/1.7.x/server-deno/examples/users/create.md new file mode 100644 index 0000000000..e0eb5856d1 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/create.md @@ -0,0 +1,16 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.create( + '<USER_ID>', // userId + 'email@example.com', // email (optional) + '+12065550100', // phone (optional) + '', // password (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/delete-identity.md b/docs/examples/1.7.x/server-deno/examples/users/delete-identity.md new file mode 100644 index 0000000000..7aea654645 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/delete-identity.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.deleteIdentity( + '<IDENTITY_ID>' // identityId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-deno/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..2d7595005e --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,13 @@ +import { Client, Users, AuthenticatorType } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.deleteMfaAuthenticator( + '<USER_ID>', // userId + AuthenticatorType.Totp // type +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/delete-session.md b/docs/examples/1.7.x/server-deno/examples/users/delete-session.md new file mode 100644 index 0000000000..0ce82fe50f --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/delete-session.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.deleteSession( + '<USER_ID>', // userId + '<SESSION_ID>' // sessionId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-deno/examples/users/delete-sessions.md new file mode 100644 index 0000000000..f80300b205 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/delete-sessions.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.deleteSessions( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/delete-target.md b/docs/examples/1.7.x/server-deno/examples/users/delete-target.md new file mode 100644 index 0000000000..9080a962e6 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/delete-target.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.deleteTarget( + '<USER_ID>', // userId + '<TARGET_ID>' // targetId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/delete.md b/docs/examples/1.7.x/server-deno/examples/users/delete.md new file mode 100644 index 0000000000..7ac1bf1d3a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/delete.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.delete( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-deno/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..f78c0bf1b0 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.getMfaRecoveryCodes( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/get-prefs.md b/docs/examples/1.7.x/server-deno/examples/users/get-prefs.md new file mode 100644 index 0000000000..ef1be1e18b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/get-prefs.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.getPrefs( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/get-target.md b/docs/examples/1.7.x/server-deno/examples/users/get-target.md new file mode 100644 index 0000000000..301ee6e7ed --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/get-target.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.getTarget( + '<USER_ID>', // userId + '<TARGET_ID>' // targetId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/get.md b/docs/examples/1.7.x/server-deno/examples/users/get.md new file mode 100644 index 0000000000..8e41ed6350 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/get.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.get( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/list-identities.md b/docs/examples/1.7.x/server-deno/examples/users/list-identities.md new file mode 100644 index 0000000000..6ac439547b --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/list-identities.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.listIdentities( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/list-logs.md b/docs/examples/1.7.x/server-deno/examples/users/list-logs.md new file mode 100644 index 0000000000..983ffba299 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/list-logs.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.listLogs( + '<USER_ID>', // userId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/list-memberships.md b/docs/examples/1.7.x/server-deno/examples/users/list-memberships.md new file mode 100644 index 0000000000..afdd4d4f2d --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/list-memberships.md @@ -0,0 +1,14 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.listMemberships( + '<USER_ID>', // userId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-deno/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..34b65afac3 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/list-mfa-factors.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.listMfaFactors( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/list-sessions.md b/docs/examples/1.7.x/server-deno/examples/users/list-sessions.md new file mode 100644 index 0000000000..314f277d7a --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/list-sessions.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.listSessions( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/list-targets.md b/docs/examples/1.7.x/server-deno/examples/users/list-targets.md new file mode 100644 index 0000000000..9ed2dda4ce --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/list-targets.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.listTargets( + '<USER_ID>', // userId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/list.md b/docs/examples/1.7.x/server-deno/examples/users/list.md new file mode 100644 index 0000000000..488fbdc09c --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/list.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-deno/examples/users/update-email-verification.md new file mode 100644 index 0000000000..3243f21c6f --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-email-verification.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updateEmailVerification( + '<USER_ID>', // userId + false // emailVerification +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-email.md b/docs/examples/1.7.x/server-deno/examples/users/update-email.md new file mode 100644 index 0000000000..f609cab463 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-email.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updateEmail( + '<USER_ID>', // userId + 'email@example.com' // email +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-labels.md b/docs/examples/1.7.x/server-deno/examples/users/update-labels.md new file mode 100644 index 0000000000..5a23298179 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-labels.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updateLabels( + '<USER_ID>', // userId + [] // labels +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-deno/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..a74577e9cc --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updateMfaRecoveryCodes( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-mfa.md b/docs/examples/1.7.x/server-deno/examples/users/update-mfa.md new file mode 100644 index 0000000000..717f8d6ab7 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-mfa.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updateMfa( + '<USER_ID>', // userId + false // mfa +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-name.md b/docs/examples/1.7.x/server-deno/examples/users/update-name.md new file mode 100644 index 0000000000..35fc853e3f --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-name.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updateName( + '<USER_ID>', // userId + '<NAME>' // name +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-password.md b/docs/examples/1.7.x/server-deno/examples/users/update-password.md new file mode 100644 index 0000000000..8366b5c4c2 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-password.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updatePassword( + '<USER_ID>', // userId + '' // password +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-deno/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..088fd1eb57 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-phone-verification.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updatePhoneVerification( + '<USER_ID>', // userId + false // phoneVerification +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-phone.md b/docs/examples/1.7.x/server-deno/examples/users/update-phone.md new file mode 100644 index 0000000000..a8e47a62b8 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-phone.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updatePhone( + '<USER_ID>', // userId + '+12065550100' // number +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-prefs.md b/docs/examples/1.7.x/server-deno/examples/users/update-prefs.md new file mode 100644 index 0000000000..cb8919a98f --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-prefs.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updatePrefs( + '<USER_ID>', // userId + {} // prefs +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-status.md b/docs/examples/1.7.x/server-deno/examples/users/update-status.md new file mode 100644 index 0000000000..1c672a4d25 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-status.md @@ -0,0 +1,13 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updateStatus( + '<USER_ID>', // userId + false // status +); diff --git a/docs/examples/1.7.x/server-deno/examples/users/update-target.md b/docs/examples/1.7.x/server-deno/examples/users/update-target.md new file mode 100644 index 0000000000..4524748c55 --- /dev/null +++ b/docs/examples/1.7.x/server-deno/examples/users/update-target.md @@ -0,0 +1,16 @@ +import { Client, Users } from "https://deno.land/x/appwrite/mod.ts"; + +const client = new Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new Users(client); + +const response = await users.updateTarget( + '<USER_ID>', // userId + '<TARGET_ID>', // targetId + '<IDENTIFIER>', // identifier (optional) + '<PROVIDER_ID>', // providerId (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..fc807aa4e5 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-anonymous-session.md @@ -0,0 +1,11 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +Session result = await account.CreateAnonymousSession(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..abf5a41317 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-email-password-session.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +Session result = await account.CreateEmailPasswordSession( + email: "email@example.com", + password: "password" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-email-token.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-email-token.md new file mode 100644 index 0000000000..69862feed0 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-email-token.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +Token result = await account.CreateEmailToken( + userId: "<USER_ID>", + email: "email@example.com", + phrase: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..423cbed2b3 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-j-w-t.md @@ -0,0 +1,11 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +JWT result = await account.CreateJWT(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..21bcef6bed --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +Token result = await account.CreateMagicURLToken( + userId: "<USER_ID>", + email: "email@example.com", + url: "https://example.com", // optional + phrase: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..bc54970469 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-mfa-authenticator.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +MfaType result = await account.CreateMfaAuthenticator( + type: AuthenticatorType.Totp +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..734133f2bd --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-mfa-challenge.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +MfaChallenge result = await account.CreateMfaChallenge( + factor: AuthenticationFactor.Email +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..1922a45c0a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +MfaRecoveryCodes result = await account.CreateMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..5b405449b1 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-o-auth2token.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +await account.CreateOAuth2Token( + provider: OAuthProvider.Amazon, + success: "https://example.com", // optional + failure: "https://example.com", // optional + scopes: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-phone-token.md new file mode 100644 index 0000000000..0d17f5ecee --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-phone-token.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +Token result = await account.CreatePhoneToken( + userId: "<USER_ID>", + phone: "+12065550100" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..185fc46e0d --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-phone-verification.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Token result = await account.CreatePhoneVerification(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-recovery.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-recovery.md new file mode 100644 index 0000000000..c2e3571d56 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-recovery.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Token result = await account.CreateRecovery( + email: "email@example.com", + url: "https://example.com" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-session.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-session.md new file mode 100644 index 0000000000..2da46ce62b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-session.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +Session result = await account.CreateSession( + userId: "<USER_ID>", + secret: "<SECRET>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create-verification.md b/docs/examples/1.7.x/server-dotnet/examples/account/create-verification.md new file mode 100644 index 0000000000..92222ea88a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create-verification.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Token result = await account.CreateVerification( + url: "https://example.com" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/create.md b/docs/examples/1.7.x/server-dotnet/examples/account/create.md new file mode 100644 index 0000000000..83c1d54251 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/create.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +User result = await account.Create( + userId: "<USER_ID>", + email: "email@example.com", + password: "", + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/delete-identity.md b/docs/examples/1.7.x/server-dotnet/examples/account/delete-identity.md new file mode 100644 index 0000000000..9b084800d4 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/delete-identity.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +await account.DeleteIdentity( + identityId: "<IDENTITY_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-dotnet/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..2b27cb6ad8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +await account.DeleteMfaAuthenticator( + type: AuthenticatorType.Totp +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/delete-session.md b/docs/examples/1.7.x/server-dotnet/examples/account/delete-session.md new file mode 100644 index 0000000000..0bca7c172a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/delete-session.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +await account.DeleteSession( + sessionId: "<SESSION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-dotnet/examples/account/delete-sessions.md new file mode 100644 index 0000000000..5b0e7b5cba --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/delete-sessions.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +await account.DeleteSessions(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dotnet/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..cc39db191d --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +MfaRecoveryCodes result = await account.GetMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/get-prefs.md b/docs/examples/1.7.x/server-dotnet/examples/account/get-prefs.md new file mode 100644 index 0000000000..b0fce89a3f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/get-prefs.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Preferences result = await account.GetPrefs(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/get-session.md b/docs/examples/1.7.x/server-dotnet/examples/account/get-session.md new file mode 100644 index 0000000000..9aa7abaee0 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/get-session.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Session result = await account.GetSession( + sessionId: "<SESSION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/get.md b/docs/examples/1.7.x/server-dotnet/examples/account/get.md new file mode 100644 index 0000000000..eecb890b30 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/get.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +User result = await account.Get(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/list-identities.md b/docs/examples/1.7.x/server-dotnet/examples/account/list-identities.md new file mode 100644 index 0000000000..661fab9f4e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/list-identities.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +IdentityList result = await account.ListIdentities( + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/list-logs.md b/docs/examples/1.7.x/server-dotnet/examples/account/list-logs.md new file mode 100644 index 0000000000..8e5eadf961 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/list-logs.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +LogList result = await account.ListLogs( + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-dotnet/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..291534920f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/list-mfa-factors.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +MfaFactors result = await account.ListMfaFactors(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/list-sessions.md b/docs/examples/1.7.x/server-dotnet/examples/account/list-sessions.md new file mode 100644 index 0000000000..6304383cb3 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/list-sessions.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +SessionList result = await account.ListSessions(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-email.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-email.md new file mode 100644 index 0000000000..06e2a2a9df --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-email.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +User result = await account.UpdateEmail( + email: "email@example.com", + password: "password" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..b9405e7e2c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-m-f-a.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +User result = await account.UpdateMFA( + mfa: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..a8d8312e18 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +Session result = await account.UpdateMagicURLSession( + userId: "<USER_ID>", + secret: "<SECRET>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..051653d19a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-mfa-authenticator.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +User result = await account.UpdateMfaAuthenticator( + type: AuthenticatorType.Totp, + otp: "<OTP>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..d273505839 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-mfa-challenge.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Session result = await account.UpdateMfaChallenge( + challengeId: "<CHALLENGE_ID>", + otp: "<OTP>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..7daaf93213 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +MfaRecoveryCodes result = await account.UpdateMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-name.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-name.md new file mode 100644 index 0000000000..6088226fc8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-name.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +User result = await account.UpdateName( + name: "<NAME>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-password.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-password.md new file mode 100644 index 0000000000..f24c703a9a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-password.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +User result = await account.UpdatePassword( + password: "", + oldPassword: "password" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-phone-session.md new file mode 100644 index 0000000000..2f8b091999 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-phone-session.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +Session result = await account.UpdatePhoneSession( + userId: "<USER_ID>", + secret: "<SECRET>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..a100c0f2e2 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-phone-verification.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Token result = await account.UpdatePhoneVerification( + userId: "<USER_ID>", + secret: "<SECRET>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-phone.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-phone.md new file mode 100644 index 0000000000..224001dd6e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-phone.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +User result = await account.UpdatePhone( + phone: "+12065550100", + password: "password" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-prefs.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-prefs.md new file mode 100644 index 0000000000..0b348a9c74 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-prefs.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +User result = await account.UpdatePrefs( + prefs: [object] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-recovery.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-recovery.md new file mode 100644 index 0000000000..188462229b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-recovery.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Token result = await account.UpdateRecovery( + userId: "<USER_ID>", + secret: "<SECRET>", + password: "" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-session.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-session.md new file mode 100644 index 0000000000..a98644c032 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-session.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Session result = await account.UpdateSession( + sessionId: "<SESSION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-status.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-status.md new file mode 100644 index 0000000000..d9c5b41d72 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-status.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +User result = await account.UpdateStatus(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/account/update-verification.md b/docs/examples/1.7.x/server-dotnet/examples/account/update-verification.md new file mode 100644 index 0000000000..b9dd1ded40 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/account/update-verification.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Account account = new Account(client); + +Token result = await account.UpdateVerification( + userId: "<USER_ID>", + secret: "<SECRET>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-browser.md new file mode 100644 index 0000000000..9c7b643af1 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-browser.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +byte[] result = await avatars.GetBrowser( + code: Browser.AvantBrowser, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..a41ade1438 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-credit-card.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +byte[] result = await avatars.GetCreditCard( + code: CreditCard.AmericanExpress, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..345d856717 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-favicon.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +byte[] result = await avatars.GetFavicon( + url: "https://example.com" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-flag.md new file mode 100644 index 0000000000..f7a3e05cee --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-flag.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +byte[] result = await avatars.GetFlag( + code: Flag.Afghanistan, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/avatars/get-image.md b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-image.md new file mode 100644 index 0000000000..4a67e58517 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-image.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +byte[] result = await avatars.GetImage( + url: "https://example.com", + width: 0, // optional + height: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-initials.md new file mode 100644 index 0000000000..55427ff622 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-initials.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +byte[] result = await avatars.GetInitials( + name: "<NAME>", // optional + width: 0, // optional + height: 0, // optional + background: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..4591b7d99c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/avatars/get-q-r.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +byte[] result = await avatars.GetQR( + text: "<TEXT>", + size: 1, // optional + margin: 0, // optional + download: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..8807648521 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-boolean-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeBoolean result = await databases.CreateBooleanAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: false, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-collection.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-collection.md new file mode 100644 index 0000000000..75a1c5c311 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-collection.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +Collection result = await databases.CreateCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + name: "<NAME>", + permissions: ["read("any")"], // optional + documentSecurity: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..7be723379e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-datetime-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeDatetime result = await databases.CreateDatetimeAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-document.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-document.md new file mode 100644 index 0000000000..cb4bc62ced --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-document.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetSession("") // The user session to authenticate with + .SetKey("<YOUR_API_KEY>") // Your secret API key + .SetJWT("<YOUR_JWT>"); // Your secret JSON Web Token + +Databases databases = new Databases(client); + +Document result = await databases.CreateDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>", + data: [object], + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-documents.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-documents.md new file mode 100644 index 0000000000..495a3080fa --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-documents.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +DocumentList result = await databases.CreateDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documents: new List<object>() +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..df00119ff9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-email-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeEmail result = await databases.CreateEmailAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "email@example.com", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..d85e8a72a9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-enum-attribute.md @@ -0,0 +1,20 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeEnum result = await databases.CreateEnumAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + elements: new List<string>(), + required: false, + default: "<DEFAULT>", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..bc03fac7ae --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-float-attribute.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeFloat result = await databases.CreateFloatAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + min: 0, // optional + max: 0, // optional + default: 0, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-index.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-index.md new file mode 100644 index 0000000000..ae5583c68d --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-index.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +Index result = await databases.CreateIndex( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + type: IndexType.Key, + attributes: new List<string>(), + orders: new List<string>(), // optional + lengths: new List<long>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..c8e7c13355 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-integer-attribute.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeInteger result = await databases.CreateIntegerAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + min: 0, // optional + max: 0, // optional + default: 0, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..f95c257089 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-ip-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeIp result = await databases.CreateIpAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..b0f4d1194f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-relationship-attribute.md @@ -0,0 +1,22 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeRelationship result = await databases.CreateRelationshipAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + relatedCollectionId: "<RELATED_COLLECTION_ID>", + type: RelationshipType.OneToOne, + twoWay: false, // optional + key: "", // optional + twoWayKey: "", // optional + onDelete: RelationMutate.Cascade // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..6cba31ff36 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-string-attribute.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeString result = await databases.CreateStringAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + size: 1, + required: false, + default: "<DEFAULT>", // optional + array: false, // optional + encrypt: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..dce1ac496a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create-url-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeUrl result = await databases.CreateUrlAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "https://example.com", // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/create.md b/docs/examples/1.7.x/server-dotnet/examples/databases/create.md new file mode 100644 index 0000000000..9b66c15cef --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/create.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +Database result = await databases.Create( + databaseId: "<DATABASE_ID>", + name: "<NAME>", + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..46eb44b4b8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-attribute.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +await databases.DeleteAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-collection.md new file mode 100644 index 0000000000..e05717dc6c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-collection.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +await databases.DeleteCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/delete-document.md b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-document.md new file mode 100644 index 0000000000..221b80e254 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-document.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Databases databases = new Databases(client); + +await databases.DeleteDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-documents.md new file mode 100644 index 0000000000..a9bc9c277b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-documents.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +await databases.DeleteDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/delete-index.md b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-index.md new file mode 100644 index 0000000000..02dcf5c66a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/delete-index.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +await databases.DeleteIndex( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/delete.md b/docs/examples/1.7.x/server-dotnet/examples/databases/delete.md new file mode 100644 index 0000000000..a877eabc02 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/delete.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +await databases.Delete( + databaseId: "<DATABASE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/get-attribute.md new file mode 100644 index 0000000000..d9e02e36b6 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/get-attribute.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + + result = await databases.GetAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/get-collection.md b/docs/examples/1.7.x/server-dotnet/examples/databases/get-collection.md new file mode 100644 index 0000000000..79fe685cbc --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/get-collection.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +Collection result = await databases.GetCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/get-document.md b/docs/examples/1.7.x/server-dotnet/examples/databases/get-document.md new file mode 100644 index 0000000000..d7e9b68807 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/get-document.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Databases databases = new Databases(client); + +Document result = await databases.GetDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/get-index.md b/docs/examples/1.7.x/server-dotnet/examples/databases/get-index.md new file mode 100644 index 0000000000..02f7b812c8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/get-index.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +Index result = await databases.GetIndex( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/get.md b/docs/examples/1.7.x/server-dotnet/examples/databases/get.md new file mode 100644 index 0000000000..174d74c4f0 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/get.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +Database result = await databases.Get( + databaseId: "<DATABASE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-dotnet/examples/databases/list-attributes.md new file mode 100644 index 0000000000..d2ac6c3afd --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/list-attributes.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeList result = await databases.ListAttributes( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/list-collections.md b/docs/examples/1.7.x/server-dotnet/examples/databases/list-collections.md new file mode 100644 index 0000000000..5dacb62e97 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/list-collections.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +CollectionList result = await databases.ListCollections( + databaseId: "<DATABASE_ID>", + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/list-documents.md b/docs/examples/1.7.x/server-dotnet/examples/databases/list-documents.md new file mode 100644 index 0000000000..f59e4576bd --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/list-documents.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Databases databases = new Databases(client); + +DocumentList result = await databases.ListDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-dotnet/examples/databases/list-indexes.md new file mode 100644 index 0000000000..e6adab1f2d --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/list-indexes.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +IndexList result = await databases.ListIndexes( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/list.md b/docs/examples/1.7.x/server-dotnet/examples/databases/list.md new file mode 100644 index 0000000000..d2b552b27c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/list.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +DatabaseList result = await databases.List( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..aa2ed498d2 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-boolean-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeBoolean result = await databases.UpdateBooleanAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: false, + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-collection.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-collection.md new file mode 100644 index 0000000000..7885ad3969 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-collection.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +Collection result = await databases.UpdateCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + name: "<NAME>", + permissions: ["read("any")"], // optional + documentSecurity: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..e6b60c8753 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-datetime-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeDatetime result = await databases.UpdateDatetimeAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-document.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-document.md new file mode 100644 index 0000000000..3121c15e08 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-document.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Databases databases = new Databases(client); + +Document result = await databases.UpdateDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>", + data: [object], // optional + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-documents.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-documents.md new file mode 100644 index 0000000000..63ded21ac9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-documents.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +DocumentList result = await databases.UpdateDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + data: [object], // optional + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..8d36a43780 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-email-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeEmail result = await databases.UpdateEmailAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "email@example.com", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..e3ca9fe124 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-enum-attribute.md @@ -0,0 +1,20 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeEnum result = await databases.UpdateEnumAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + elements: new List<string>(), + required: false, + default: "<DEFAULT>", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..46328d26f5 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-float-attribute.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeFloat result = await databases.UpdateFloatAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: 0, + min: 0, // optional + max: 0, // optional + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..91ff1897c7 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-integer-attribute.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeInteger result = await databases.UpdateIntegerAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: 0, + min: 0, // optional + max: 0, // optional + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..dfcb5d214a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-ip-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeIp result = await databases.UpdateIpAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..5b6dd71467 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-relationship-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeRelationship result = await databases.UpdateRelationshipAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + onDelete: RelationMutate.Cascade, // optional + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..918fdc0e3f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-string-attribute.md @@ -0,0 +1,20 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeString result = await databases.UpdateStringAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "<DEFAULT>", + size: 1, // optional + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..8766a3f2f7 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update-url-attribute.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +AttributeUrl result = await databases.UpdateUrlAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "https://example.com", + newKey: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/update.md b/docs/examples/1.7.x/server-dotnet/examples/databases/update.md new file mode 100644 index 0000000000..d4dd28aa2b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/update.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +Database result = await databases.Update( + databaseId: "<DATABASE_ID>", + name: "<NAME>", + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-dotnet/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..d9db60ce2d --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/databases/upsert-documents.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +DocumentList result = await databases.UpsertDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documents: new List<object>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/functions/create-deployment.md new file mode 100644 index 0000000000..26c6ff4c42 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/create-deployment.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Deployment result = await functions.CreateDeployment( + functionId: "<FUNCTION_ID>", + code: InputFile.FromPath("./path-to-files/image.jpg"), + activate: false, + entrypoint: "<ENTRYPOINT>", // optional + commands: "<COMMANDS>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..057fe12b10 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Deployment result = await functions.CreateDuplicateDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>", + buildId: "<BUILD_ID>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/create-execution.md b/docs/examples/1.7.x/server-dotnet/examples/functions/create-execution.md new file mode 100644 index 0000000000..c8fd5595e9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/create-execution.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Functions functions = new Functions(client); + +Execution result = await functions.CreateExecution( + functionId: "<FUNCTION_ID>", + body: "<BODY>", // optional + async: false, // optional + path: "<PATH>", // optional + method: ExecutionMethod.GET, // optional + headers: [object], // optional + scheduledAt: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..019a9bf256 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/create-template-deployment.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Deployment result = await functions.CreateTemplateDeployment( + functionId: "<FUNCTION_ID>", + repository: "<REPOSITORY>", + owner: "<OWNER>", + rootDirectory: "<ROOT_DIRECTORY>", + version: "<VERSION>", + activate: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/create-variable.md b/docs/examples/1.7.x/server-dotnet/examples/functions/create-variable.md new file mode 100644 index 0000000000..6d1f85b12e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/create-variable.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Variable result = await functions.CreateVariable( + functionId: "<FUNCTION_ID>", + key: "<KEY>", + value: "<VALUE>", + secret: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..9651365912 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/create-vcs-deployment.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Deployment result = await functions.CreateVcsDeployment( + functionId: "<FUNCTION_ID>", + type: VCSDeploymentType.Branch, + reference: "<REFERENCE>", + activate: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/create.md b/docs/examples/1.7.x/server-dotnet/examples/functions/create.md new file mode 100644 index 0000000000..6e705228f1 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/create.md @@ -0,0 +1,32 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Function result = await functions.Create( + functionId: "<FUNCTION_ID>", + name: "<NAME>", + runtime: .Node145, + execute: ["any"], // optional + events: new List<string>(), // optional + schedule: "", // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: "<ENTRYPOINT>", // optional + commands: "<COMMANDS>", // optional + scopes: new List<string>(), // optional + installationId: "<INSTALLATION_ID>", // optional + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch: "<PROVIDER_BRANCH>", // optional + providerSilentMode: false, // optional + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", // optional + specification: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..33c537ad0d --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/delete-deployment.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +await functions.DeleteDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-dotnet/examples/functions/delete-execution.md new file mode 100644 index 0000000000..5d5ab8dee2 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/delete-execution.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +await functions.DeleteExecution( + functionId: "<FUNCTION_ID>", + executionId: "<EXECUTION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-dotnet/examples/functions/delete-variable.md new file mode 100644 index 0000000000..263c3f6420 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/delete-variable.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +await functions.DeleteVariable( + functionId: "<FUNCTION_ID>", + variableId: "<VARIABLE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/delete.md b/docs/examples/1.7.x/server-dotnet/examples/functions/delete.md new file mode 100644 index 0000000000..ed780ac15a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/delete.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +await functions.Delete( + functionId: "<FUNCTION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-dotnet/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..bfc3209635 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/get-deployment-download.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +byte[] result = await functions.GetDeploymentDownload( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>", + type: DeploymentDownloadType.Source // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/functions/get-deployment.md new file mode 100644 index 0000000000..5fe31a2f6e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/get-deployment.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Deployment result = await functions.GetDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/get-execution.md b/docs/examples/1.7.x/server-dotnet/examples/functions/get-execution.md new file mode 100644 index 0000000000..8581b968af --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/get-execution.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Functions functions = new Functions(client); + +Execution result = await functions.GetExecution( + functionId: "<FUNCTION_ID>", + executionId: "<EXECUTION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/get-variable.md b/docs/examples/1.7.x/server-dotnet/examples/functions/get-variable.md new file mode 100644 index 0000000000..57ba993389 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/get-variable.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Variable result = await functions.GetVariable( + functionId: "<FUNCTION_ID>", + variableId: "<VARIABLE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/get.md b/docs/examples/1.7.x/server-dotnet/examples/functions/get.md new file mode 100644 index 0000000000..baba5d0b4a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/get.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Function result = await functions.Get( + functionId: "<FUNCTION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-dotnet/examples/functions/list-deployments.md new file mode 100644 index 0000000000..093befcf61 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/list-deployments.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +DeploymentList result = await functions.ListDeployments( + functionId: "<FUNCTION_ID>", + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/list-executions.md b/docs/examples/1.7.x/server-dotnet/examples/functions/list-executions.md new file mode 100644 index 0000000000..6ec320eb7a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/list-executions.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Functions functions = new Functions(client); + +ExecutionList result = await functions.ListExecutions( + functionId: "<FUNCTION_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-dotnet/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..c238671670 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/list-runtimes.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +RuntimeList result = await functions.ListRuntimes(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-dotnet/examples/functions/list-specifications.md new file mode 100644 index 0000000000..2d868d1343 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/list-specifications.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +SpecificationList result = await functions.ListSpecifications(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/list-variables.md b/docs/examples/1.7.x/server-dotnet/examples/functions/list-variables.md new file mode 100644 index 0000000000..4c85da8995 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/list-variables.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +VariableList result = await functions.ListVariables( + functionId: "<FUNCTION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/list.md b/docs/examples/1.7.x/server-dotnet/examples/functions/list.md new file mode 100644 index 0000000000..750642d498 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/list.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +FunctionList result = await functions.List( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-dotnet/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..4dd70b1932 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/update-deployment-status.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Deployment result = await functions.UpdateDeploymentStatus( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..7bdbd91b5c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/update-function-deployment.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Function result = await functions.UpdateFunctionDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/update-variable.md b/docs/examples/1.7.x/server-dotnet/examples/functions/update-variable.md new file mode 100644 index 0000000000..2b776d69ea --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/update-variable.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Variable result = await functions.UpdateVariable( + functionId: "<FUNCTION_ID>", + variableId: "<VARIABLE_ID>", + key: "<KEY>", + value: "<VALUE>", // optional + secret: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/functions/update.md b/docs/examples/1.7.x/server-dotnet/examples/functions/update.md new file mode 100644 index 0000000000..7160795f77 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/functions/update.md @@ -0,0 +1,32 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +Function result = await functions.Update( + functionId: "<FUNCTION_ID>", + name: "<NAME>", + runtime: .Node145, // optional + execute: ["any"], // optional + events: new List<string>(), // optional + schedule: "", // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: "<ENTRYPOINT>", // optional + commands: "<COMMANDS>", // optional + scopes: new List<string>(), // optional + installationId: "<INSTALLATION_ID>", // optional + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch: "<PROVIDER_BRANCH>", // optional + providerSilentMode: false, // optional + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", // optional + specification: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/graphql/mutation.md b/docs/examples/1.7.x/server-dotnet/examples/graphql/mutation.md new file mode 100644 index 0000000000..b153e34d51 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/graphql/mutation.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Graphql graphql = new Graphql(client); + +Any result = await graphql.Mutation( + query: [object] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/graphql/query.md b/docs/examples/1.7.x/server-dotnet/examples/graphql/query.md new file mode 100644 index 0000000000..61345d7665 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/graphql/query.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Graphql graphql = new Graphql(client); + +Any result = await graphql.Query( + query: [object] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-antivirus.md new file mode 100644 index 0000000000..115c0e5c7b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-antivirus.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthAntivirus result = await health.GetAntivirus(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-cache.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-cache.md new file mode 100644 index 0000000000..0c5ec37c2b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-cache.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthStatus result = await health.GetCache(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-certificate.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-certificate.md new file mode 100644 index 0000000000..457b70128a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-certificate.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthCertificate result = await health.GetCertificate( + domain: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-d-b.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-d-b.md new file mode 100644 index 0000000000..7ae8b14854 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-d-b.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthStatus result = await health.GetDB(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..4d43479831 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-failed-jobs.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetFailedJobs( + name: .V1Database, + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..4ffdd7e531 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-pub-sub.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthStatus result = await health.GetPubSub(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..5d522f03f2 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-builds.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueBuilds( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..c7e186e5ee --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-certificates.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueCertificates( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..1db6fb518c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-databases.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueDatabases( + name: "<NAME>", // optional + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..487cee3411 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-deletes.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueDeletes( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..949e3766a7 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-functions.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueFunctions( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..58ad1ac2fe --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-logs.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueLogs( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..2c1008c7b1 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-mails.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueMails( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..4116f19b1f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-messaging.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueMessaging( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..5a0c7a0337 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-migrations.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueMigrations( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..4002cca158 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-stats-resources.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueStatsResources( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..546e9a07de --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-usage.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueUsage( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..1fc8d4d63c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-queue-webhooks.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthQueue result = await health.GetQueueWebhooks( + threshold: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-storage-local.md new file mode 100644 index 0000000000..3e8539794a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-storage-local.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthStatus result = await health.GetStorageLocal(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-storage.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-storage.md new file mode 100644 index 0000000000..42d4aba45b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-storage.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthStatus result = await health.GetStorage(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get-time.md b/docs/examples/1.7.x/server-dotnet/examples/health/get-time.md new file mode 100644 index 0000000000..959060113b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get-time.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthTime result = await health.GetTime(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/health/get.md b/docs/examples/1.7.x/server-dotnet/examples/health/get.md new file mode 100644 index 0000000000..a926fe71e5 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/health/get.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +HealthStatus result = await health.Get(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/locale/get.md b/docs/examples/1.7.x/server-dotnet/examples/locale/get.md new file mode 100644 index 0000000000..48b9701801 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/locale/get.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +Locale result = await locale.Get(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/locale/list-codes.md b/docs/examples/1.7.x/server-dotnet/examples/locale/list-codes.md new file mode 100644 index 0000000000..0df7696da5 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/locale/list-codes.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +LocaleCodeList result = await locale.ListCodes(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/locale/list-continents.md b/docs/examples/1.7.x/server-dotnet/examples/locale/list-continents.md new file mode 100644 index 0000000000..7cf74caec3 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/locale/list-continents.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +ContinentList result = await locale.ListContinents(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-dotnet/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..106e140ee4 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/locale/list-countries-e-u.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +CountryList result = await locale.ListCountriesEU(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-dotnet/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..38fbe24ff3 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/locale/list-countries-phones.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +PhoneList result = await locale.ListCountriesPhones(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/locale/list-countries.md b/docs/examples/1.7.x/server-dotnet/examples/locale/list-countries.md new file mode 100644 index 0000000000..5e5d9f407f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/locale/list-countries.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +CountryList result = await locale.ListCountries(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-dotnet/examples/locale/list-currencies.md new file mode 100644 index 0000000000..e51a138813 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/locale/list-currencies.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +CurrencyList result = await locale.ListCurrencies(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/locale/list-languages.md b/docs/examples/1.7.x/server-dotnet/examples/locale/list-languages.md new file mode 100644 index 0000000000..62aa15d1d9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/locale/list-languages.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +LanguageList result = await locale.ListLanguages(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..9cc37a17e0 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-apns-provider.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateApnsProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + authKey: "<AUTH_KEY>", // optional + authKeyId: "<AUTH_KEY_ID>", // optional + teamId: "<TEAM_ID>", // optional + bundleId: "<BUNDLE_ID>", // optional + sandbox: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-email.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-email.md new file mode 100644 index 0000000000..51c6db4ddb --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-email.md @@ -0,0 +1,25 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Message result = await messaging.CreateEmail( + messageId: "<MESSAGE_ID>", + subject: "<SUBJECT>", + content: "<CONTENT>", + topics: new List<string>(), // optional + users: new List<string>(), // optional + targets: new List<string>(), // optional + cc: new List<string>(), // optional + bcc: new List<string>(), // optional + attachments: new List<string>(), // optional + draft: false, // optional + html: false, // optional + scheduledAt: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..15fdace2d3 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-fcm-provider.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateFcmProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + serviceAccountJSON: [object], // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..1bacbab8d5 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,23 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateMailgunProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + apiKey: "<API_KEY>", // optional + domain: "<DOMAIN>", // optional + isEuRegion: false, // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "email@example.com", // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..a0b7372709 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-msg91provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateMsg91Provider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + templateId: "<TEMPLATE_ID>", // optional + senderId: "<SENDER_ID>", // optional + authKey: "<AUTH_KEY>", // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-push.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-push.md new file mode 100644 index 0000000000..1d2dbec1f2 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-push.md @@ -0,0 +1,33 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Message result = await messaging.CreatePush( + messageId: "<MESSAGE_ID>", + title: "<TITLE>", // optional + body: "<BODY>", // optional + topics: new List<string>(), // optional + users: new List<string>(), // optional + targets: new List<string>(), // optional + data: [object], // optional + action: "<ACTION>", // optional + image: "[ID1:ID2]", // optional + icon: "<ICON>", // optional + sound: "<SOUND>", // optional + color: "<COLOR>", // optional + tag: "<TAG>", // optional + badge: 0, // optional + draft: false, // optional + scheduledAt: "", // optional + contentAvailable: false, // optional + critical: false, // optional + priority: MessagePriority.Normal // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..8464c47ae1 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateSendgridProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + apiKey: "<API_KEY>", // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "email@example.com", // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-sms.md new file mode 100644 index 0000000000..06e9e69e65 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-sms.md @@ -0,0 +1,20 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Message result = await messaging.CreateSms( + messageId: "<MESSAGE_ID>", + content: "<CONTENT>", + topics: new List<string>(), // optional + users: new List<string>(), // optional + targets: new List<string>(), // optional + draft: false, // optional + scheduledAt: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..16b091f98e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-smtp-provider.md @@ -0,0 +1,28 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateSmtpProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + host: "<HOST>", + port: 1, // optional + username: "<USERNAME>", // optional + password: "<PASSWORD>", // optional + encryption: SmtpEncryption.None, // optional + autoTLS: false, // optional + mailer: "<MAILER>", // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "email@example.com", // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..8b37d31e68 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-subscriber.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetJWT("<YOUR_JWT>"); // Your secret JSON Web Token + +Messaging messaging = new Messaging(client); + +Subscriber result = await messaging.CreateSubscriber( + topicId: "<TOPIC_ID>", + subscriberId: "<SUBSCRIBER_ID>", + targetId: "<TARGET_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..37e1bd1df9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-telesign-provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateTelesignProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", // optional + customerId: "<CUSTOMER_ID>", // optional + apiKey: "<API_KEY>", // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..7dc0a6b26f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateTextmagicProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", // optional + username: "<USERNAME>", // optional + apiKey: "<API_KEY>", // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-topic.md new file mode 100644 index 0000000000..51eab0fd11 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-topic.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Topic result = await messaging.CreateTopic( + topicId: "<TOPIC_ID>", + name: "<NAME>", + subscribe: ["any"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..0deba742ff --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-twilio-provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateTwilioProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", // optional + accountSid: "<ACCOUNT_SID>", // optional + authToken: "<AUTH_TOKEN>", // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..8f4855aab4 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/create-vonage-provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.CreateVonageProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", // optional + apiKey: "<API_KEY>", // optional + apiSecret: "<API_SECRET>", // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..a1ca2a1450 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/delete-provider.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +await messaging.DeleteProvider( + providerId: "<PROVIDER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..9424535c9f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/delete-subscriber.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetJWT("<YOUR_JWT>"); // Your secret JSON Web Token + +Messaging messaging = new Messaging(client); + +await messaging.DeleteSubscriber( + topicId: "<TOPIC_ID>", + subscriberId: "<SUBSCRIBER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..0b4819a219 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/delete-topic.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +await messaging.DeleteTopic( + topicId: "<TOPIC_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/delete.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/delete.md new file mode 100644 index 0000000000..ff041e853a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/delete.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +await messaging.Delete( + messageId: "<MESSAGE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/get-message.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/get-message.md new file mode 100644 index 0000000000..0dad3668f8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/get-message.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Message result = await messaging.GetMessage( + messageId: "<MESSAGE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/get-provider.md new file mode 100644 index 0000000000..fac5a07da5 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/get-provider.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.GetProvider( + providerId: "<PROVIDER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..516aa682c8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/get-subscriber.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Subscriber result = await messaging.GetSubscriber( + topicId: "<TOPIC_ID>", + subscriberId: "<SUBSCRIBER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/get-topic.md new file mode 100644 index 0000000000..3a662b3111 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/get-topic.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Topic result = await messaging.GetTopic( + topicId: "<TOPIC_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..49d3513127 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-message-logs.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +LogList result = await messaging.ListMessageLogs( + messageId: "<MESSAGE_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-messages.md new file mode 100644 index 0000000000..4c17128e72 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-messages.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +MessageList result = await messaging.ListMessages( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..928c14845a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-provider-logs.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +LogList result = await messaging.ListProviderLogs( + providerId: "<PROVIDER_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-providers.md new file mode 100644 index 0000000000..6cf5757fb6 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-providers.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +ProviderList result = await messaging.ListProviders( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..815f1325d4 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +LogList result = await messaging.ListSubscriberLogs( + subscriberId: "<SUBSCRIBER_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..b522be327c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-subscribers.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +SubscriberList result = await messaging.ListSubscribers( + topicId: "<TOPIC_ID>", + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-targets.md new file mode 100644 index 0000000000..a8e8de567e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-targets.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +TargetList result = await messaging.ListTargets( + messageId: "<MESSAGE_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..093db0ff2c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-topic-logs.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +LogList result = await messaging.ListTopicLogs( + topicId: "<TOPIC_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-topics.md new file mode 100644 index 0000000000..cc88afab69 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/list-topics.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +TopicList result = await messaging.ListTopics( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..f06e134d02 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-apns-provider.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateApnsProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + authKey: "<AUTH_KEY>", // optional + authKeyId: "<AUTH_KEY_ID>", // optional + teamId: "<TEAM_ID>", // optional + bundleId: "<BUNDLE_ID>", // optional + sandbox: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-email.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-email.md new file mode 100644 index 0000000000..90d1555d8f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-email.md @@ -0,0 +1,25 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Message result = await messaging.UpdateEmail( + messageId: "<MESSAGE_ID>", + topics: new List<string>(), // optional + users: new List<string>(), // optional + targets: new List<string>(), // optional + subject: "<SUBJECT>", // optional + content: "<CONTENT>", // optional + draft: false, // optional + html: false, // optional + cc: new List<string>(), // optional + bcc: new List<string>(), // optional + scheduledAt: "", // optional + attachments: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..0006fedf54 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-fcm-provider.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateFcmProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + serviceAccountJSON: [object] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..512cb0586b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,23 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateMailgunProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + apiKey: "<API_KEY>", // optional + domain: "<DOMAIN>", // optional + isEuRegion: false, // optional + enabled: false, // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "<REPLY_TO_EMAIL>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..51355c5836 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-msg91provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateMsg91Provider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + templateId: "<TEMPLATE_ID>", // optional + senderId: "<SENDER_ID>", // optional + authKey: "<AUTH_KEY>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-push.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-push.md new file mode 100644 index 0000000000..37da215e82 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-push.md @@ -0,0 +1,33 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Message result = await messaging.UpdatePush( + messageId: "<MESSAGE_ID>", + topics: new List<string>(), // optional + users: new List<string>(), // optional + targets: new List<string>(), // optional + title: "<TITLE>", // optional + body: "<BODY>", // optional + data: [object], // optional + action: "<ACTION>", // optional + image: "[ID1:ID2]", // optional + icon: "<ICON>", // optional + sound: "<SOUND>", // optional + color: "<COLOR>", // optional + tag: "<TAG>", // optional + badge: 0, // optional + draft: false, // optional + scheduledAt: "", // optional + contentAvailable: false, // optional + critical: false, // optional + priority: MessagePriority.Normal // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..d718a7158b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,21 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateSendgridProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + apiKey: "<API_KEY>", // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "<REPLY_TO_EMAIL>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-sms.md new file mode 100644 index 0000000000..475d29923d --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-sms.md @@ -0,0 +1,20 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Message result = await messaging.UpdateSms( + messageId: "<MESSAGE_ID>", + topics: new List<string>(), // optional + users: new List<string>(), // optional + targets: new List<string>(), // optional + content: "<CONTENT>", // optional + draft: false, // optional + scheduledAt: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..4e7ab6dfeb --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-smtp-provider.md @@ -0,0 +1,28 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateSmtpProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + host: "<HOST>", // optional + port: 1, // optional + username: "<USERNAME>", // optional + password: "<PASSWORD>", // optional + encryption: SmtpEncryption.None, // optional + autoTLS: false, // optional + mailer: "<MAILER>", // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "<REPLY_TO_EMAIL>", // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..d4f1c5e015 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-telesign-provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateTelesignProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + customerId: "<CUSTOMER_ID>", // optional + apiKey: "<API_KEY>", // optional + from: "<FROM>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..3529f9b99c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateTextmagicProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + username: "<USERNAME>", // optional + apiKey: "<API_KEY>", // optional + from: "<FROM>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-topic.md new file mode 100644 index 0000000000..11943f70e2 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-topic.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Topic result = await messaging.UpdateTopic( + topicId: "<TOPIC_ID>", + name: "<NAME>", // optional + subscribe: ["any"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..66fc7e27a3 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-twilio-provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateTwilioProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + accountSid: "<ACCOUNT_SID>", // optional + authToken: "<AUTH_TOKEN>", // optional + from: "<FROM>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..03addd3de6 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/messaging/update-vonage-provider.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +Provider result = await messaging.UpdateVonageProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + apiKey: "<API_KEY>", // optional + apiSecret: "<API_SECRET>", // optional + from: "<FROM>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/sites/create-deployment.md new file mode 100644 index 0000000000..1bcb5d5bac --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/create-deployment.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Deployment result = await sites.CreateDeployment( + siteId: "<SITE_ID>", + code: InputFile.FromPath("./path-to-files/image.jpg"), + activate: false, + installCommand: "<INSTALL_COMMAND>", // optional + buildCommand: "<BUILD_COMMAND>", // optional + outputDirectory: "<OUTPUT_DIRECTORY>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..1e45aca8ef --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Deployment result = await sites.CreateDuplicateDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..57f9a83d9c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/create-template-deployment.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Deployment result = await sites.CreateTemplateDeployment( + siteId: "<SITE_ID>", + repository: "<REPOSITORY>", + owner: "<OWNER>", + rootDirectory: "<ROOT_DIRECTORY>", + version: "<VERSION>", + activate: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/create-variable.md b/docs/examples/1.7.x/server-dotnet/examples/sites/create-variable.md new file mode 100644 index 0000000000..09feb0316e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/create-variable.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Variable result = await sites.CreateVariable( + siteId: "<SITE_ID>", + key: "<KEY>", + value: "<VALUE>", + secret: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..4d3e685176 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/create-vcs-deployment.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Deployment result = await sites.CreateVcsDeployment( + siteId: "<SITE_ID>", + type: VCSDeploymentType.Branch, + reference: "<REFERENCE>", + activate: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/create.md b/docs/examples/1.7.x/server-dotnet/examples/sites/create.md new file mode 100644 index 0000000000..025adca41d --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/create.md @@ -0,0 +1,32 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Site result = await sites.Create( + siteId: "<SITE_ID>", + name: "<NAME>", + framework: .Analog, + buildRuntime: .Node145, + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: "<INSTALL_COMMAND>", // optional + buildCommand: "<BUILD_COMMAND>", // optional + outputDirectory: "<OUTPUT_DIRECTORY>", // optional + adapter: .Static, // optional + installationId: "<INSTALLATION_ID>", // optional + fallbackFile: "<FALLBACK_FILE>", // optional + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch: "<PROVIDER_BRANCH>", // optional + providerSilentMode: false, // optional + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", // optional + specification: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..f74be24acf --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/delete-deployment.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +await sites.DeleteDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/delete-log.md b/docs/examples/1.7.x/server-dotnet/examples/sites/delete-log.md new file mode 100644 index 0000000000..83d1aa12ca --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/delete-log.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +await sites.DeleteLog( + siteId: "<SITE_ID>", + logId: "<LOG_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-dotnet/examples/sites/delete-variable.md new file mode 100644 index 0000000000..9751512718 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/delete-variable.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +await sites.DeleteVariable( + siteId: "<SITE_ID>", + variableId: "<VARIABLE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/delete.md b/docs/examples/1.7.x/server-dotnet/examples/sites/delete.md new file mode 100644 index 0000000000..173c486499 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/delete.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +await sites.Delete( + siteId: "<SITE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-dotnet/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..27c9647629 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/get-deployment-download.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +byte[] result = await sites.GetDeploymentDownload( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>", + type: DeploymentDownloadType.Source // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/sites/get-deployment.md new file mode 100644 index 0000000000..138c97ba42 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/get-deployment.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Deployment result = await sites.GetDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/get-log.md b/docs/examples/1.7.x/server-dotnet/examples/sites/get-log.md new file mode 100644 index 0000000000..d90b6c8477 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/get-log.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Execution result = await sites.GetLog( + siteId: "<SITE_ID>", + logId: "<LOG_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/get-variable.md b/docs/examples/1.7.x/server-dotnet/examples/sites/get-variable.md new file mode 100644 index 0000000000..01f57f3bf2 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/get-variable.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Variable result = await sites.GetVariable( + siteId: "<SITE_ID>", + variableId: "<VARIABLE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/get.md b/docs/examples/1.7.x/server-dotnet/examples/sites/get.md new file mode 100644 index 0000000000..87a91ae8e8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/get.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Site result = await sites.Get( + siteId: "<SITE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-dotnet/examples/sites/list-deployments.md new file mode 100644 index 0000000000..ac1cae9127 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/list-deployments.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +DeploymentList result = await sites.ListDeployments( + siteId: "<SITE_ID>", + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-dotnet/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..9220b2a7da --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/list-frameworks.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +FrameworkList result = await sites.ListFrameworks(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/list-logs.md b/docs/examples/1.7.x/server-dotnet/examples/sites/list-logs.md new file mode 100644 index 0000000000..692bd707b2 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/list-logs.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +ExecutionList result = await sites.ListLogs( + siteId: "<SITE_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-dotnet/examples/sites/list-specifications.md new file mode 100644 index 0000000000..edf82da81b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/list-specifications.md @@ -0,0 +1,12 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +SpecificationList result = await sites.ListSpecifications(); diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/list-variables.md b/docs/examples/1.7.x/server-dotnet/examples/sites/list-variables.md new file mode 100644 index 0000000000..6eb0ff7093 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/list-variables.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +VariableList result = await sites.ListVariables( + siteId: "<SITE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/list.md b/docs/examples/1.7.x/server-dotnet/examples/sites/list.md new file mode 100644 index 0000000000..649ee50331 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/list.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +SiteList result = await sites.List( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-dotnet/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..c7415e7a0b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/update-deployment-status.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Deployment result = await sites.UpdateDeploymentStatus( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-dotnet/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..8706ff594a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/update-site-deployment.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Site result = await sites.UpdateSiteDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/update-variable.md b/docs/examples/1.7.x/server-dotnet/examples/sites/update-variable.md new file mode 100644 index 0000000000..99718cd6cd --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/update-variable.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Variable result = await sites.UpdateVariable( + siteId: "<SITE_ID>", + variableId: "<VARIABLE_ID>", + key: "<KEY>", + value: "<VALUE>", // optional + secret: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/sites/update.md b/docs/examples/1.7.x/server-dotnet/examples/sites/update.md new file mode 100644 index 0000000000..c25e3f6df9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/sites/update.md @@ -0,0 +1,32 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +Site result = await sites.Update( + siteId: "<SITE_ID>", + name: "<NAME>", + framework: .Analog, + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: "<INSTALL_COMMAND>", // optional + buildCommand: "<BUILD_COMMAND>", // optional + outputDirectory: "<OUTPUT_DIRECTORY>", // optional + buildRuntime: .Node145, // optional + adapter: .Static, // optional + fallbackFile: "<FALLBACK_FILE>", // optional + installationId: "<INSTALLATION_ID>", // optional + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch: "<PROVIDER_BRANCH>", // optional + providerSilentMode: false, // optional + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", // optional + specification: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-dotnet/examples/storage/create-bucket.md new file mode 100644 index 0000000000..0cc317d9a6 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/create-bucket.md @@ -0,0 +1,24 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +Bucket result = await storage.CreateBucket( + bucketId: "<BUCKET_ID>", + name: "<NAME>", + permissions: ["read("any")"], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: new List<string>(), // optional + compression: .None, // optional + encryption: false, // optional + antivirus: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/create-file.md b/docs/examples/1.7.x/server-dotnet/examples/storage/create-file.md new file mode 100644 index 0000000000..a4cedb8214 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/create-file.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +File result = await storage.CreateFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + file: InputFile.FromPath("./path-to-files/image.jpg"), + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-dotnet/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..22aa2acf19 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/delete-bucket.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +await storage.DeleteBucket( + bucketId: "<BUCKET_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/delete-file.md b/docs/examples/1.7.x/server-dotnet/examples/storage/delete-file.md new file mode 100644 index 0000000000..a8cc310aa5 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/delete-file.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +await storage.DeleteFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-dotnet/examples/storage/get-bucket.md new file mode 100644 index 0000000000..a6f74ebdae --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/get-bucket.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +Bucket result = await storage.GetBucket( + bucketId: "<BUCKET_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-dotnet/examples/storage/get-file-download.md new file mode 100644 index 0000000000..514fda9e9c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/get-file-download.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +byte[] result = await storage.GetFileDownload( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + token: "<TOKEN>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-dotnet/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..c9ec508b4a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/get-file-preview.md @@ -0,0 +1,28 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +byte[] result = await storage.GetFilePreview( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + width: 0, // optional + height: 0, // optional + gravity: ImageGravity.Center, // optional + quality: -1, // optional + borderWidth: 0, // optional + borderColor: "", // optional + borderRadius: 0, // optional + opacity: 0, // optional + rotation: -360, // optional + background: "", // optional + output: ImageFormat.Jpg, // optional + token: "<TOKEN>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-dotnet/examples/storage/get-file-view.md new file mode 100644 index 0000000000..1a27dc153c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/get-file-view.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +byte[] result = await storage.GetFileView( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + token: "<TOKEN>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/get-file.md b/docs/examples/1.7.x/server-dotnet/examples/storage/get-file.md new file mode 100644 index 0000000000..e4c05c1e6b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/get-file.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +File result = await storage.GetFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-dotnet/examples/storage/list-buckets.md new file mode 100644 index 0000000000..8e397729e6 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/list-buckets.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +BucketList result = await storage.ListBuckets( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/list-files.md b/docs/examples/1.7.x/server-dotnet/examples/storage/list-files.md new file mode 100644 index 0000000000..2751da5244 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/list-files.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +FileList result = await storage.ListFiles( + bucketId: "<BUCKET_ID>", + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-dotnet/examples/storage/update-bucket.md new file mode 100644 index 0000000000..2a439ba2af --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/update-bucket.md @@ -0,0 +1,24 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +Bucket result = await storage.UpdateBucket( + bucketId: "<BUCKET_ID>", + name: "<NAME>", + permissions: ["read("any")"], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: new List<string>(), // optional + compression: .None, // optional + encryption: false, // optional + antivirus: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/storage/update-file.md b/docs/examples/1.7.x/server-dotnet/examples/storage/update-file.md new file mode 100644 index 0000000000..3f6ea608d7 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/storage/update-file.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +File result = await storage.UpdateFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + name: "<NAME>", // optional + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/create-membership.md b/docs/examples/1.7.x/server-dotnet/examples/teams/create-membership.md new file mode 100644 index 0000000000..f3f5682cbf --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/create-membership.md @@ -0,0 +1,20 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +Membership result = await teams.CreateMembership( + teamId: "<TEAM_ID>", + roles: new List<string>(), + email: "email@example.com", // optional + userId: "<USER_ID>", // optional + phone: "+12065550100", // optional + url: "https://example.com", // optional + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/create.md b/docs/examples/1.7.x/server-dotnet/examples/teams/create.md new file mode 100644 index 0000000000..07b102d70a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/create.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +Team result = await teams.Create( + teamId: "<TEAM_ID>", + name: "<NAME>", + roles: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-dotnet/examples/teams/delete-membership.md new file mode 100644 index 0000000000..01a58aaa11 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/delete-membership.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +await teams.DeleteMembership( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/delete.md b/docs/examples/1.7.x/server-dotnet/examples/teams/delete.md new file mode 100644 index 0000000000..ee525f23c9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/delete.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +await teams.Delete( + teamId: "<TEAM_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/get-membership.md b/docs/examples/1.7.x/server-dotnet/examples/teams/get-membership.md new file mode 100644 index 0000000000..cb9109df14 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/get-membership.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +Membership result = await teams.GetMembership( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-dotnet/examples/teams/get-prefs.md new file mode 100644 index 0000000000..f95d73af77 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/get-prefs.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +Preferences result = await teams.GetPrefs( + teamId: "<TEAM_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/get.md b/docs/examples/1.7.x/server-dotnet/examples/teams/get.md new file mode 100644 index 0000000000..339b33f657 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/get.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +Team result = await teams.Get( + teamId: "<TEAM_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-dotnet/examples/teams/list-memberships.md new file mode 100644 index 0000000000..6072158100 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/list-memberships.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +MembershipList result = await teams.ListMemberships( + teamId: "<TEAM_ID>", + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/list.md b/docs/examples/1.7.x/server-dotnet/examples/teams/list.md new file mode 100644 index 0000000000..b1ca72b82e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/list.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +TeamList result = await teams.List( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-dotnet/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..87609aa32e --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/update-membership-status.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +Membership result = await teams.UpdateMembershipStatus( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>", + userId: "<USER_ID>", + secret: "<SECRET>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/update-membership.md b/docs/examples/1.7.x/server-dotnet/examples/teams/update-membership.md new file mode 100644 index 0000000000..3583b4d0a9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/update-membership.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +Membership result = await teams.UpdateMembership( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>", + roles: new List<string>() +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/update-name.md b/docs/examples/1.7.x/server-dotnet/examples/teams/update-name.md new file mode 100644 index 0000000000..9a3fb1316a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/update-name.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +Team result = await teams.UpdateName( + teamId: "<TEAM_ID>", + name: "<NAME>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-dotnet/examples/teams/update-prefs.md new file mode 100644 index 0000000000..55ff96e9e8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/teams/update-prefs.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +Preferences result = await teams.UpdatePrefs( + teamId: "<TEAM_ID>", + prefs: [object] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-dotnet/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..70f4ed3900 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/tokens/create-file-token.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +ResourceToken result = await tokens.CreateFileToken( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + expire: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/tokens/delete.md b/docs/examples/1.7.x/server-dotnet/examples/tokens/delete.md new file mode 100644 index 0000000000..e88147c1c9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/tokens/delete.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +await tokens.Delete( + tokenId: "<TOKEN_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/tokens/get.md b/docs/examples/1.7.x/server-dotnet/examples/tokens/get.md new file mode 100644 index 0000000000..da9b431017 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/tokens/get.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +ResourceToken result = await tokens.Get( + tokenId: "<TOKEN_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/tokens/list.md b/docs/examples/1.7.x/server-dotnet/examples/tokens/list.md new file mode 100644 index 0000000000..68579f237b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/tokens/list.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +ResourceTokenList result = await tokens.List( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/tokens/update.md b/docs/examples/1.7.x/server-dotnet/examples/tokens/update.md new file mode 100644 index 0000000000..b7604182ab --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/tokens/update.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +ResourceToken result = await tokens.Update( + tokenId: "<TOKEN_ID>", + expire: "" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-argon2user.md new file mode 100644 index 0000000000..db6dd6486a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-argon2user.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.CreateArgon2User( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..bf8bf3dedd --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-bcrypt-user.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.CreateBcryptUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..a7c57ad642 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-j-w-t.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +JWT result = await users.CreateJWT( + userId: "<USER_ID>", + sessionId: "<SESSION_ID>", // optional + duration: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..7b7d0e7760 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-m-d5user.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.CreateMD5User( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..9b43dc02af --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +MfaRecoveryCodes result = await users.CreateMfaRecoveryCodes( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..9f5521ef2f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-p-h-pass-user.md @@ -0,0 +1,17 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.CreatePHPassUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..0821bf46e9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-s-h-a-user.md @@ -0,0 +1,19 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.CreateSHAUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + passwordVersion: PasswordHash.Sha1, // optional + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..3af99e88c2 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,20 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.CreateScryptModifiedUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + passwordSalt: "<PASSWORD_SALT>", + passwordSaltSeparator: "<PASSWORD_SALT_SEPARATOR>", + passwordSignerKey: "<PASSWORD_SIGNER_KEY>", + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..79085f7206 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-scrypt-user.md @@ -0,0 +1,22 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.CreateScryptUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + passwordSalt: "<PASSWORD_SALT>", + passwordCpu: 0, + passwordMemory: 0, + passwordParallel: 0, + passwordLength: 0, + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-session.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-session.md new file mode 100644 index 0000000000..a021c2551f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-session.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +Session result = await users.CreateSession( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-target.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-target.md new file mode 100644 index 0000000000..44ba48ac01 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-target.md @@ -0,0 +1,20 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +Target result = await users.CreateTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>", + providerType: MessagingProviderType.Email, + identifier: "<IDENTIFIER>", + providerId: "<PROVIDER_ID>", // optional + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create-token.md b/docs/examples/1.7.x/server-dotnet/examples/users/create-token.md new file mode 100644 index 0000000000..0e9cf43fd7 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create-token.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +Token result = await users.CreateToken( + userId: "<USER_ID>", + length: 4, // optional + expire: 60 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/create.md b/docs/examples/1.7.x/server-dotnet/examples/users/create.md new file mode 100644 index 0000000000..3cf1d3af29 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/create.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.Create( + userId: "<USER_ID>", + email: "email@example.com", // optional + phone: "+12065550100", // optional + password: "", // optional + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/delete-identity.md b/docs/examples/1.7.x/server-dotnet/examples/users/delete-identity.md new file mode 100644 index 0000000000..d2bac6b797 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/delete-identity.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +await users.DeleteIdentity( + identityId: "<IDENTITY_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-dotnet/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..bb33dbf9e4 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Enums; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +await users.DeleteMfaAuthenticator( + userId: "<USER_ID>", + type: AuthenticatorType.Totp +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/delete-session.md b/docs/examples/1.7.x/server-dotnet/examples/users/delete-session.md new file mode 100644 index 0000000000..d9d36d20b4 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/delete-session.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +await users.DeleteSession( + userId: "<USER_ID>", + sessionId: "<SESSION_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-dotnet/examples/users/delete-sessions.md new file mode 100644 index 0000000000..7011e426bb --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/delete-sessions.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +await users.DeleteSessions( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/delete-target.md b/docs/examples/1.7.x/server-dotnet/examples/users/delete-target.md new file mode 100644 index 0000000000..ad900afa5a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/delete-target.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +await users.DeleteTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/delete.md b/docs/examples/1.7.x/server-dotnet/examples/users/delete.md new file mode 100644 index 0000000000..00ed23cf5f --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/delete.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +await users.Delete( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dotnet/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..213c3473a8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +MfaRecoveryCodes result = await users.GetMfaRecoveryCodes( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/get-prefs.md b/docs/examples/1.7.x/server-dotnet/examples/users/get-prefs.md new file mode 100644 index 0000000000..36888651d9 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/get-prefs.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +Preferences result = await users.GetPrefs( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/get-target.md b/docs/examples/1.7.x/server-dotnet/examples/users/get-target.md new file mode 100644 index 0000000000..2bbf4d614c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/get-target.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +Target result = await users.GetTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/get.md b/docs/examples/1.7.x/server-dotnet/examples/users/get.md new file mode 100644 index 0000000000..25971baddc --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/get.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.Get( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/list-identities.md b/docs/examples/1.7.x/server-dotnet/examples/users/list-identities.md new file mode 100644 index 0000000000..996edfba71 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/list-identities.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +IdentityList result = await users.ListIdentities( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/list-logs.md b/docs/examples/1.7.x/server-dotnet/examples/users/list-logs.md new file mode 100644 index 0000000000..822d16fe64 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/list-logs.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +LogList result = await users.ListLogs( + userId: "<USER_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/list-memberships.md b/docs/examples/1.7.x/server-dotnet/examples/users/list-memberships.md new file mode 100644 index 0000000000..4296cd2dcd --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/list-memberships.md @@ -0,0 +1,16 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +MembershipList result = await users.ListMemberships( + userId: "<USER_ID>", + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-dotnet/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..54f68ae516 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/list-mfa-factors.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +MfaFactors result = await users.ListMfaFactors( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/list-sessions.md b/docs/examples/1.7.x/server-dotnet/examples/users/list-sessions.md new file mode 100644 index 0000000000..97f92f3b07 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/list-sessions.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +SessionList result = await users.ListSessions( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/list-targets.md b/docs/examples/1.7.x/server-dotnet/examples/users/list-targets.md new file mode 100644 index 0000000000..aa59ce2983 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/list-targets.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +TargetList result = await users.ListTargets( + userId: "<USER_ID>", + queries: new List<string>() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/list.md b/docs/examples/1.7.x/server-dotnet/examples/users/list.md new file mode 100644 index 0000000000..aae7ae27b3 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/list.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +UserList result = await users.List( + queries: new List<string>(), // optional + search: "<SEARCH>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-email-verification.md new file mode 100644 index 0000000000..8add2d4d6b --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-email-verification.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.UpdateEmailVerification( + userId: "<USER_ID>", + emailVerification: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-email.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-email.md new file mode 100644 index 0000000000..d0d737cb80 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-email.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.UpdateEmail( + userId: "<USER_ID>", + email: "email@example.com" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-labels.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-labels.md new file mode 100644 index 0000000000..6637ad0438 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-labels.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.UpdateLabels( + userId: "<USER_ID>", + labels: new List<string>() +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..35be70777a --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +MfaRecoveryCodes result = await users.UpdateMfaRecoveryCodes( + userId: "<USER_ID>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-mfa.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-mfa.md new file mode 100644 index 0000000000..d009df1759 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-mfa.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.UpdateMfa( + userId: "<USER_ID>", + mfa: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-name.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-name.md new file mode 100644 index 0000000000..ffa90f9657 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-name.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.UpdateName( + userId: "<USER_ID>", + name: "<NAME>" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-password.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-password.md new file mode 100644 index 0000000000..6dc30d5bcf --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-password.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.UpdatePassword( + userId: "<USER_ID>", + password: "" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..ba5ca253ee --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-phone-verification.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.UpdatePhoneVerification( + userId: "<USER_ID>", + phoneVerification: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-phone.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-phone.md new file mode 100644 index 0000000000..e633740e94 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-phone.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.UpdatePhone( + userId: "<USER_ID>", + number: "+12065550100" +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-prefs.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-prefs.md new file mode 100644 index 0000000000..421a4c2314 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-prefs.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +Preferences result = await users.UpdatePrefs( + userId: "<USER_ID>", + prefs: [object] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-status.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-status.md new file mode 100644 index 0000000000..3037d8dd0c --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-status.md @@ -0,0 +1,15 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +User result = await users.UpdateStatus( + userId: "<USER_ID>", + status: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-dotnet/examples/users/update-target.md b/docs/examples/1.7.x/server-dotnet/examples/users/update-target.md new file mode 100644 index 0000000000..9863af19d8 --- /dev/null +++ b/docs/examples/1.7.x/server-dotnet/examples/users/update-target.md @@ -0,0 +1,18 @@ +using Appwrite; +using Appwrite.Models; +using Appwrite.Services; + +Client client = new Client() + .SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .SetProject("<YOUR_PROJECT_ID>") // Your project ID + .SetKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +Target result = await users.UpdateTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>", + identifier: "<IDENTIFIER>", // optional + providerId: "<PROVIDER_ID>", // optional + name: "<NAME>" // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-go/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-go/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..a6b5b6a2cf --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-anonymous-session.md @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.CreateAnonymousSession( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-go/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..d876edc7ac --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-email-password-session.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.CreateEmailPasswordSession( + "email@example.com", + "password", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-email-token.md b/docs/examples/1.7.x/server-go/examples/account/create-email-token.md new file mode 100644 index 0000000000..aa832e7bf5 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-email-token.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.CreateEmailToken( + "<USER_ID>", + "email@example.com", + account.WithCreateEmailTokenPhrase(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-go/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..fad35ab519 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-j-w-t.md @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.CreateJWT( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-go/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..1e2090fd8e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.CreateMagicURLToken( + "<USER_ID>", + "email@example.com", + account.WithCreateMagicURLTokenUrl("https://example.com"), + account.WithCreateMagicURLTokenPhrase(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-go/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..8d425404b5 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-mfa-authenticator.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.CreateMfaAuthenticator( + "totp", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-go/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..3ac4a3babf --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-mfa-challenge.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.CreateMfaChallenge( + "email", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-go/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..063a804f6e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.CreateMfaRecoveryCodes( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-go/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..f3b6997fff --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-o-auth2token.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.CreateOAuth2Token( + "amazon", + account.WithCreateOAuth2TokenSuccess("https://example.com"), + account.WithCreateOAuth2TokenFailure("https://example.com"), + account.WithCreateOAuth2TokenScopes([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-go/examples/account/create-phone-token.md new file mode 100644 index 0000000000..c9e80de622 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-phone-token.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.CreatePhoneToken( + "<USER_ID>", + "+12065550100", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-go/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..c7a6bf4bf5 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-phone-verification.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.CreatePhoneVerification( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-recovery.md b/docs/examples/1.7.x/server-go/examples/account/create-recovery.md new file mode 100644 index 0000000000..9d55755c37 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-recovery.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.CreateRecovery( + "email@example.com", + "https://example.com", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-session.md b/docs/examples/1.7.x/server-go/examples/account/create-session.md new file mode 100644 index 0000000000..f93502a31f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-session.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.CreateSession( + "<USER_ID>", + "<SECRET>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create-verification.md b/docs/examples/1.7.x/server-go/examples/account/create-verification.md new file mode 100644 index 0000000000..afb98c7ec0 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create-verification.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.CreateVerification( + "https://example.com", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/create.md b/docs/examples/1.7.x/server-go/examples/account/create.md new file mode 100644 index 0000000000..b834d47d0f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/create.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.Create( + "<USER_ID>", + "email@example.com", + "", + account.WithCreateName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/delete-identity.md b/docs/examples/1.7.x/server-go/examples/account/delete-identity.md new file mode 100644 index 0000000000..30d2534602 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/delete-identity.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.DeleteIdentity( + "<IDENTITY_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-go/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..7f3edec33d --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.DeleteMfaAuthenticator( + "totp", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/delete-session.md b/docs/examples/1.7.x/server-go/examples/account/delete-session.md new file mode 100644 index 0000000000..398604ecdd --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/delete-session.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.DeleteSession( + "<SESSION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-go/examples/account/delete-sessions.md new file mode 100644 index 0000000000..97eda5899a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/delete-sessions.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.DeleteSessions( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-go/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..0dd93bb765 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.GetMfaRecoveryCodes( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/get-prefs.md b/docs/examples/1.7.x/server-go/examples/account/get-prefs.md new file mode 100644 index 0000000000..b7985acbd7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/get-prefs.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.GetPrefs( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/get-session.md b/docs/examples/1.7.x/server-go/examples/account/get-session.md new file mode 100644 index 0000000000..d6d1ffe05f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/get-session.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.GetSession( + "<SESSION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/get.md b/docs/examples/1.7.x/server-go/examples/account/get.md new file mode 100644 index 0000000000..7e08024930 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/get.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.Get( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/list-identities.md b/docs/examples/1.7.x/server-go/examples/account/list-identities.md new file mode 100644 index 0000000000..7a7f4bc09f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/list-identities.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.ListIdentities( + account.WithListIdentitiesQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/list-logs.md b/docs/examples/1.7.x/server-go/examples/account/list-logs.md new file mode 100644 index 0000000000..eec9ed33e0 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/list-logs.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.ListLogs( + account.WithListLogsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-go/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..4dca59fff6 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/list-mfa-factors.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.ListMfaFactors( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/list-sessions.md b/docs/examples/1.7.x/server-go/examples/account/list-sessions.md new file mode 100644 index 0000000000..9f8a5f4799 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/list-sessions.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.ListSessions( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-email.md b/docs/examples/1.7.x/server-go/examples/account/update-email.md new file mode 100644 index 0000000000..11f98265b6 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-email.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateEmail( + "email@example.com", + "password", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-go/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..d3df3d4638 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-m-f-a.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateMFA( + false, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-go/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..fdc9d45c04 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.UpdateMagicURLSession( + "<USER_ID>", + "<SECRET>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-go/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..fb225574d4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-mfa-authenticator.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateMfaAuthenticator( + "totp", + "<OTP>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-go/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..1e95a60d34 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-mfa-challenge.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateMfaChallenge( + "<CHALLENGE_ID>", + "<OTP>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-go/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..08feede261 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateMfaRecoveryCodes( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-name.md b/docs/examples/1.7.x/server-go/examples/account/update-name.md new file mode 100644 index 0000000000..8424a26946 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-name.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateName( + "<NAME>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-password.md b/docs/examples/1.7.x/server-go/examples/account/update-password.md new file mode 100644 index 0000000000..561ff0a667 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-password.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdatePassword( + "", + account.WithUpdatePasswordOldPassword("password"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-go/examples/account/update-phone-session.md new file mode 100644 index 0000000000..433043e439 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-phone-session.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + + service := account.NewAccount(client) + response, error := service.UpdatePhoneSession( + "<USER_ID>", + "<SECRET>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-go/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..46602a8be8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-phone-verification.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdatePhoneVerification( + "<USER_ID>", + "<SECRET>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-phone.md b/docs/examples/1.7.x/server-go/examples/account/update-phone.md new file mode 100644 index 0000000000..d753cb21d3 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-phone.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdatePhone( + "+12065550100", + "password", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-prefs.md b/docs/examples/1.7.x/server-go/examples/account/update-prefs.md new file mode 100644 index 0000000000..0319de200a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-prefs.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdatePrefs( + map[string]interface{}{}, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-recovery.md b/docs/examples/1.7.x/server-go/examples/account/update-recovery.md new file mode 100644 index 0000000000..f40414e5e8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-recovery.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateRecovery( + "<USER_ID>", + "<SECRET>", + "", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-session.md b/docs/examples/1.7.x/server-go/examples/account/update-session.md new file mode 100644 index 0000000000..8e1725a71c --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-session.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateSession( + "<SESSION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-status.md b/docs/examples/1.7.x/server-go/examples/account/update-status.md new file mode 100644 index 0000000000..a9a0e239b0 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-status.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateStatus( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/account/update-verification.md b/docs/examples/1.7.x/server-go/examples/account/update-verification.md new file mode 100644 index 0000000000..2fd356dcf8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/account/update-verification.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/account" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := account.NewAccount(client) + response, error := service.UpdateVerification( + "<USER_ID>", + "<SECRET>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-go/examples/avatars/get-browser.md new file mode 100644 index 0000000000..34f3bf58f9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/avatars/get-browser.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/avatars" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := avatars.NewAvatars(client) + response, error := service.GetBrowser( + "aa", + avatars.WithGetBrowserWidth(0), + avatars.WithGetBrowserHeight(0), + avatars.WithGetBrowserQuality(-1), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-go/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..764debd877 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/avatars/get-credit-card.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/avatars" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := avatars.NewAvatars(client) + response, error := service.GetCreditCard( + "amex", + avatars.WithGetCreditCardWidth(0), + avatars.WithGetCreditCardHeight(0), + avatars.WithGetCreditCardQuality(-1), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-go/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..bdea40db2f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/avatars/get-favicon.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/avatars" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := avatars.NewAvatars(client) + response, error := service.GetFavicon( + "https://example.com", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-go/examples/avatars/get-flag.md new file mode 100644 index 0000000000..dfda1ed687 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/avatars/get-flag.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/avatars" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := avatars.NewAvatars(client) + response, error := service.GetFlag( + "af", + avatars.WithGetFlagWidth(0), + avatars.WithGetFlagHeight(0), + avatars.WithGetFlagQuality(-1), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/avatars/get-image.md b/docs/examples/1.7.x/server-go/examples/avatars/get-image.md new file mode 100644 index 0000000000..a751abb927 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/avatars/get-image.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/avatars" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := avatars.NewAvatars(client) + response, error := service.GetImage( + "https://example.com", + avatars.WithGetImageWidth(0), + avatars.WithGetImageHeight(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-go/examples/avatars/get-initials.md new file mode 100644 index 0000000000..21fa9282ae --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/avatars/get-initials.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/avatars" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := avatars.NewAvatars(client) + response, error := service.GetInitials( + avatars.WithGetInitialsName("<NAME>"), + avatars.WithGetInitialsWidth(0), + avatars.WithGetInitialsHeight(0), + avatars.WithGetInitialsBackground(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-go/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..8eeea5f6bf --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/avatars/get-q-r.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/avatars" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := avatars.NewAvatars(client) + response, error := service.GetQR( + "<TEXT>", + avatars.WithGetQRSize(1), + avatars.WithGetQRMargin(0), + avatars.WithGetQRDownload(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..73e118e3b7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-boolean-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateBooleanAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + databases.WithCreateBooleanAttributeDefault(false), + databases.WithCreateBooleanAttributeArray(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-collection.md b/docs/examples/1.7.x/server-go/examples/databases/create-collection.md new file mode 100644 index 0000000000..815b21d6cb --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-collection.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateCollection( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<NAME>", + databases.WithCreateCollectionPermissions(interface{}{"read("any")"}), + databases.WithCreateCollectionDocumentSecurity(false), + databases.WithCreateCollectionEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..edf716911d --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-datetime-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateDatetimeAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + databases.WithCreateDatetimeAttributeDefault(""), + databases.WithCreateDatetimeAttributeArray(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-document.md b/docs/examples/1.7.x/server-go/examples/databases/create-document.md new file mode 100644 index 0000000000..5a5280a107 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-document.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetSession("") // The user session to authenticate with + client.SetKey("<YOUR_API_KEY>") // Your secret API key + client.SetJWT("<YOUR_JWT>") // Your secret JSON Web Token + + service := databases.NewDatabases(client) + response, error := service.CreateDocument( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<DOCUMENT_ID>", + map[string]interface{}{}, + databases.WithCreateDocumentPermissions(interface{}{"read("any")"}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-documents.md b/docs/examples/1.7.x/server-go/examples/databases/create-documents.md new file mode 100644 index 0000000000..4199c28230 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-documents.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateDocuments( + "<DATABASE_ID>", + "<COLLECTION_ID>", + []interface{}{}, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..f564b4033a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-email-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateEmailAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + databases.WithCreateEmailAttributeDefault("email@example.com"), + databases.WithCreateEmailAttributeArray(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..0827d31e1a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-enum-attribute.md @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateEnumAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + []interface{}{}, + false, + databases.WithCreateEnumAttributeDefault("<DEFAULT>"), + databases.WithCreateEnumAttributeArray(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..a262e1d3f3 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-float-attribute.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateFloatAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + databases.WithCreateFloatAttributeMin(0), + databases.WithCreateFloatAttributeMax(0), + databases.WithCreateFloatAttributeDefault(0), + databases.WithCreateFloatAttributeArray(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-index.md b/docs/examples/1.7.x/server-go/examples/databases/create-index.md new file mode 100644 index 0000000000..83e97d8e36 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-index.md @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateIndex( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + "key", + []interface{}{}, + databases.WithCreateIndexOrders([]interface{}{}), + databases.WithCreateIndexLengths([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..daa54f9ec6 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-integer-attribute.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateIntegerAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + databases.WithCreateIntegerAttributeMin(0), + databases.WithCreateIntegerAttributeMax(0), + databases.WithCreateIntegerAttributeDefault(0), + databases.WithCreateIntegerAttributeArray(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..4c5c9c37c2 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-ip-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateIpAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + databases.WithCreateIpAttributeDefault(""), + databases.WithCreateIpAttributeArray(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..e10aee8ddd --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-relationship-attribute.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateRelationshipAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<RELATED_COLLECTION_ID>", + "oneToOne", + databases.WithCreateRelationshipAttributeTwoWay(false), + databases.WithCreateRelationshipAttributeKey(""), + databases.WithCreateRelationshipAttributeTwoWayKey(""), + databases.WithCreateRelationshipAttributeOnDelete("cascade"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..e4bd63ce35 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-string-attribute.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateStringAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + 1, + false, + databases.WithCreateStringAttributeDefault("<DEFAULT>"), + databases.WithCreateStringAttributeArray(false), + databases.WithCreateStringAttributeEncrypt(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..9d8b2e13f8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create-url-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.CreateUrlAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + databases.WithCreateUrlAttributeDefault("https://example.com"), + databases.WithCreateUrlAttributeArray(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/create.md b/docs/examples/1.7.x/server-go/examples/databases/create.md new file mode 100644 index 0000000000..80f9f92c29 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/create.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.Create( + "<DATABASE_ID>", + "<NAME>", + databases.WithCreateEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..746dae5d0b --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/delete-attribute.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.DeleteAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-go/examples/databases/delete-collection.md new file mode 100644 index 0000000000..abf6a7ae20 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/delete-collection.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.DeleteCollection( + "<DATABASE_ID>", + "<COLLECTION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/delete-document.md b/docs/examples/1.7.x/server-go/examples/databases/delete-document.md new file mode 100644 index 0000000000..e8131a73f5 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/delete-document.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := databases.NewDatabases(client) + response, error := service.DeleteDocument( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<DOCUMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-go/examples/databases/delete-documents.md new file mode 100644 index 0000000000..6527cee677 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/delete-documents.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.DeleteDocuments( + "<DATABASE_ID>", + "<COLLECTION_ID>", + databases.WithDeleteDocumentsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/delete-index.md b/docs/examples/1.7.x/server-go/examples/databases/delete-index.md new file mode 100644 index 0000000000..38e6bc94d0 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/delete-index.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.DeleteIndex( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/delete.md b/docs/examples/1.7.x/server-go/examples/databases/delete.md new file mode 100644 index 0000000000..0e7fb0a058 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/delete.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.Delete( + "<DATABASE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/get-attribute.md new file mode 100644 index 0000000000..64ba82e65c --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/get-attribute.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.GetAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/get-collection.md b/docs/examples/1.7.x/server-go/examples/databases/get-collection.md new file mode 100644 index 0000000000..ee166a4ff9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/get-collection.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.GetCollection( + "<DATABASE_ID>", + "<COLLECTION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/get-document.md b/docs/examples/1.7.x/server-go/examples/databases/get-document.md new file mode 100644 index 0000000000..657a3dcab3 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/get-document.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := databases.NewDatabases(client) + response, error := service.GetDocument( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<DOCUMENT_ID>", + databases.WithGetDocumentQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/get-index.md b/docs/examples/1.7.x/server-go/examples/databases/get-index.md new file mode 100644 index 0000000000..efc9c1f950 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/get-index.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.GetIndex( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/get.md b/docs/examples/1.7.x/server-go/examples/databases/get.md new file mode 100644 index 0000000000..b6d337111b --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/get.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.Get( + "<DATABASE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-go/examples/databases/list-attributes.md new file mode 100644 index 0000000000..8095b75d19 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/list-attributes.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.ListAttributes( + "<DATABASE_ID>", + "<COLLECTION_ID>", + databases.WithListAttributesQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/list-collections.md b/docs/examples/1.7.x/server-go/examples/databases/list-collections.md new file mode 100644 index 0000000000..2303c98bde --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/list-collections.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.ListCollections( + "<DATABASE_ID>", + databases.WithListCollectionsQueries([]interface{}{}), + databases.WithListCollectionsSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/list-documents.md b/docs/examples/1.7.x/server-go/examples/databases/list-documents.md new file mode 100644 index 0000000000..952a1b2b48 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/list-documents.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := databases.NewDatabases(client) + response, error := service.ListDocuments( + "<DATABASE_ID>", + "<COLLECTION_ID>", + databases.WithListDocumentsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-go/examples/databases/list-indexes.md new file mode 100644 index 0000000000..8593dd71b7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/list-indexes.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.ListIndexes( + "<DATABASE_ID>", + "<COLLECTION_ID>", + databases.WithListIndexesQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/list.md b/docs/examples/1.7.x/server-go/examples/databases/list.md new file mode 100644 index 0000000000..798e33b6ea --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/list.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.List( + databases.WithListQueries([]interface{}{}), + databases.WithListSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..770617635d --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-boolean-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateBooleanAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + false, + databases.WithUpdateBooleanAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-collection.md b/docs/examples/1.7.x/server-go/examples/databases/update-collection.md new file mode 100644 index 0000000000..1f80eaa255 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-collection.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateCollection( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<NAME>", + databases.WithUpdateCollectionPermissions(interface{}{"read("any")"}), + databases.WithUpdateCollectionDocumentSecurity(false), + databases.WithUpdateCollectionEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..252334b20f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-datetime-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateDatetimeAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + "", + databases.WithUpdateDatetimeAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-document.md b/docs/examples/1.7.x/server-go/examples/databases/update-document.md new file mode 100644 index 0000000000..5ec0e189e9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-document.md @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := databases.NewDatabases(client) + response, error := service.UpdateDocument( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "<DOCUMENT_ID>", + databases.WithUpdateDocumentData(map[string]interface{}{}), + databases.WithUpdateDocumentPermissions(interface{}{"read("any")"}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-documents.md b/docs/examples/1.7.x/server-go/examples/databases/update-documents.md new file mode 100644 index 0000000000..e654590691 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-documents.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateDocuments( + "<DATABASE_ID>", + "<COLLECTION_ID>", + databases.WithUpdateDocumentsData(map[string]interface{}{}), + databases.WithUpdateDocumentsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..c2e0cf9552 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-email-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateEmailAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + "email@example.com", + databases.WithUpdateEmailAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..fb993f37cc --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-enum-attribute.md @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateEnumAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + []interface{}{}, + false, + "<DEFAULT>", + databases.WithUpdateEnumAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..814da25bde --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-float-attribute.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateFloatAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + 0, + databases.WithUpdateFloatAttributeMin(0), + databases.WithUpdateFloatAttributeMax(0), + databases.WithUpdateFloatAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..961374e3db --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-integer-attribute.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateIntegerAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + 0, + databases.WithUpdateIntegerAttributeMin(0), + databases.WithUpdateIntegerAttributeMax(0), + databases.WithUpdateIntegerAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..4895feb54d --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-ip-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateIpAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + "", + databases.WithUpdateIpAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..6df9de2015 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-relationship-attribute.md @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateRelationshipAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + databases.WithUpdateRelationshipAttributeOnDelete("cascade"), + databases.WithUpdateRelationshipAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..0469527d04 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-string-attribute.md @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateStringAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + "<DEFAULT>", + databases.WithUpdateStringAttributeSize(1), + databases.WithUpdateStringAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-go/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..53e2a482ef --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update-url-attribute.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpdateUrlAttribute( + "<DATABASE_ID>", + "<COLLECTION_ID>", + "", + false, + "https://example.com", + databases.WithUpdateUrlAttributeNewKey(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/update.md b/docs/examples/1.7.x/server-go/examples/databases/update.md new file mode 100644 index 0000000000..8f5c6896a6 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/update.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.Update( + "<DATABASE_ID>", + "<NAME>", + databases.WithUpdateEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-go/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..a8399f79c0 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/databases/upsert-documents.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/databases" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := databases.NewDatabases(client) + response, error := service.UpsertDocuments( + "<DATABASE_ID>", + "<COLLECTION_ID>", + databases.WithUpsertDocumentsDocuments([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-go/examples/functions/create-deployment.md new file mode 100644 index 0000000000..afcfeb3173 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/create-deployment.md @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.CreateDeployment( + "<FUNCTION_ID>", + file.NewInputFile("/path/to/file.png", "file.png"), + false, + functions.WithCreateDeploymentEntrypoint("<ENTRYPOINT>"), + functions.WithCreateDeploymentCommands("<COMMANDS>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-go/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..f632371703 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.CreateDuplicateDeployment( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>", + functions.WithCreateDuplicateDeploymentBuildId("<BUILD_ID>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/create-execution.md b/docs/examples/1.7.x/server-go/examples/functions/create-execution.md new file mode 100644 index 0000000000..356e851376 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/create-execution.md @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := functions.NewFunctions(client) + response, error := service.CreateExecution( + "<FUNCTION_ID>", + functions.WithCreateExecutionBody("<BODY>"), + functions.WithCreateExecutionAsync(false), + functions.WithCreateExecutionPath("<PATH>"), + functions.WithCreateExecutionMethod("GET"), + functions.WithCreateExecutionHeaders(map[string]interface{}{}), + functions.WithCreateExecutionScheduledAt(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-go/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..b0b1ab8f4a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/create-template-deployment.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.CreateTemplateDeployment( + "<FUNCTION_ID>", + "<REPOSITORY>", + "<OWNER>", + "<ROOT_DIRECTORY>", + "<VERSION>", + functions.WithCreateTemplateDeploymentActivate(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/create-variable.md b/docs/examples/1.7.x/server-go/examples/functions/create-variable.md new file mode 100644 index 0000000000..961869e325 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/create-variable.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.CreateVariable( + "<FUNCTION_ID>", + "<KEY>", + "<VALUE>", + functions.WithCreateVariableSecret(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-go/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..06e583ebe1 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/create-vcs-deployment.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.CreateVcsDeployment( + "<FUNCTION_ID>", + "branch", + "<REFERENCE>", + functions.WithCreateVcsDeploymentActivate(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/create.md b/docs/examples/1.7.x/server-go/examples/functions/create.md new file mode 100644 index 0000000000..c3b13d1ff7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/create.md @@ -0,0 +1,43 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.Create( + "<FUNCTION_ID>", + "<NAME>", + "node-14.5", + functions.WithCreateExecute(interface{}{"any"}), + functions.WithCreateEvents([]interface{}{}), + functions.WithCreateSchedule(""), + functions.WithCreateTimeout(1), + functions.WithCreateEnabled(false), + functions.WithCreateLogging(false), + functions.WithCreateEntrypoint("<ENTRYPOINT>"), + functions.WithCreateCommands("<COMMANDS>"), + functions.WithCreateScopes([]interface{}{}), + functions.WithCreateInstallationId("<INSTALLATION_ID>"), + functions.WithCreateProviderRepositoryId("<PROVIDER_REPOSITORY_ID>"), + functions.WithCreateProviderBranch("<PROVIDER_BRANCH>"), + functions.WithCreateProviderSilentMode(false), + functions.WithCreateProviderRootDirectory("<PROVIDER_ROOT_DIRECTORY>"), + functions.WithCreateSpecification(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-go/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..cf088e82c8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/delete-deployment.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.DeleteDeployment( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-go/examples/functions/delete-execution.md new file mode 100644 index 0000000000..e863e3ba57 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/delete-execution.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.DeleteExecution( + "<FUNCTION_ID>", + "<EXECUTION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-go/examples/functions/delete-variable.md new file mode 100644 index 0000000000..7cb66a04ce --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/delete-variable.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.DeleteVariable( + "<FUNCTION_ID>", + "<VARIABLE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/delete.md b/docs/examples/1.7.x/server-go/examples/functions/delete.md new file mode 100644 index 0000000000..ec006f2079 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/delete.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.Delete( + "<FUNCTION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-go/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..f867d4f903 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/get-deployment-download.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.GetDeploymentDownload( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>", + functions.WithGetDeploymentDownloadType("source"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-go/examples/functions/get-deployment.md new file mode 100644 index 0000000000..6b6824500a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/get-deployment.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.GetDeployment( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/get-execution.md b/docs/examples/1.7.x/server-go/examples/functions/get-execution.md new file mode 100644 index 0000000000..627c95b5a7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/get-execution.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := functions.NewFunctions(client) + response, error := service.GetExecution( + "<FUNCTION_ID>", + "<EXECUTION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/get-variable.md b/docs/examples/1.7.x/server-go/examples/functions/get-variable.md new file mode 100644 index 0000000000..003baf4011 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/get-variable.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.GetVariable( + "<FUNCTION_ID>", + "<VARIABLE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/get.md b/docs/examples/1.7.x/server-go/examples/functions/get.md new file mode 100644 index 0000000000..a18d0526de --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/get.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.Get( + "<FUNCTION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-go/examples/functions/list-deployments.md new file mode 100644 index 0000000000..b137c3047c --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/list-deployments.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.ListDeployments( + "<FUNCTION_ID>", + functions.WithListDeploymentsQueries([]interface{}{}), + functions.WithListDeploymentsSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/list-executions.md b/docs/examples/1.7.x/server-go/examples/functions/list-executions.md new file mode 100644 index 0000000000..758d3f80d7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/list-executions.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := functions.NewFunctions(client) + response, error := service.ListExecutions( + "<FUNCTION_ID>", + functions.WithListExecutionsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-go/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..76e4414df2 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/list-runtimes.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.ListRuntimes( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-go/examples/functions/list-specifications.md new file mode 100644 index 0000000000..c1abea5d17 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/list-specifications.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.ListSpecifications( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/list-variables.md b/docs/examples/1.7.x/server-go/examples/functions/list-variables.md new file mode 100644 index 0000000000..e27df96670 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/list-variables.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.ListVariables( + "<FUNCTION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/list.md b/docs/examples/1.7.x/server-go/examples/functions/list.md new file mode 100644 index 0000000000..36a55d72b2 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/list.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.List( + functions.WithListQueries([]interface{}{}), + functions.WithListSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-go/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..d89d59200a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/update-deployment-status.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.UpdateDeploymentStatus( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-go/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..ee0ccf5e21 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/update-function-deployment.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.UpdateFunctionDeployment( + "<FUNCTION_ID>", + "<DEPLOYMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/update-variable.md b/docs/examples/1.7.x/server-go/examples/functions/update-variable.md new file mode 100644 index 0000000000..42ec29a914 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/update-variable.md @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.UpdateVariable( + "<FUNCTION_ID>", + "<VARIABLE_ID>", + "<KEY>", + functions.WithUpdateVariableValue("<VALUE>"), + functions.WithUpdateVariableSecret(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/functions/update.md b/docs/examples/1.7.x/server-go/examples/functions/update.md new file mode 100644 index 0000000000..318ba4dfd0 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/functions/update.md @@ -0,0 +1,43 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/functions" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := functions.NewFunctions(client) + response, error := service.Update( + "<FUNCTION_ID>", + "<NAME>", + functions.WithUpdateRuntime("node-14.5"), + functions.WithUpdateExecute(interface{}{"any"}), + functions.WithUpdateEvents([]interface{}{}), + functions.WithUpdateSchedule(""), + functions.WithUpdateTimeout(1), + functions.WithUpdateEnabled(false), + functions.WithUpdateLogging(false), + functions.WithUpdateEntrypoint("<ENTRYPOINT>"), + functions.WithUpdateCommands("<COMMANDS>"), + functions.WithUpdateScopes([]interface{}{}), + functions.WithUpdateInstallationId("<INSTALLATION_ID>"), + functions.WithUpdateProviderRepositoryId("<PROVIDER_REPOSITORY_ID>"), + functions.WithUpdateProviderBranch("<PROVIDER_BRANCH>"), + functions.WithUpdateProviderSilentMode(false), + functions.WithUpdateProviderRootDirectory("<PROVIDER_ROOT_DIRECTORY>"), + functions.WithUpdateSpecification(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/graphql/mutation.md b/docs/examples/1.7.x/server-go/examples/graphql/mutation.md new file mode 100644 index 0000000000..092e817c93 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/graphql/mutation.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/graphql" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := graphql.NewGraphql(client) + response, error := service.Mutation( + map[string]interface{}{}, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/graphql/query.md b/docs/examples/1.7.x/server-go/examples/graphql/query.md new file mode 100644 index 0000000000..511d6c452e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/graphql/query.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/graphql" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := graphql.NewGraphql(client) + response, error := service.Query( + map[string]interface{}{}, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-go/examples/health/get-antivirus.md new file mode 100644 index 0000000000..1640c01c0e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-antivirus.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetAntivirus( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-cache.md b/docs/examples/1.7.x/server-go/examples/health/get-cache.md new file mode 100644 index 0000000000..976d51fbe7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-cache.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetCache( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-certificate.md b/docs/examples/1.7.x/server-go/examples/health/get-certificate.md new file mode 100644 index 0000000000..44d1d1bb92 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-certificate.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetCertificate( + health.WithGetCertificateDomain(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-d-b.md b/docs/examples/1.7.x/server-go/examples/health/get-d-b.md new file mode 100644 index 0000000000..8f681a04c1 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-d-b.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetDB( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-go/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..814b8850e8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-failed-jobs.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetFailedJobs( + "v1-database", + health.WithGetFailedJobsThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-go/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..6a3d67e838 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-pub-sub.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetPubSub( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..ebd1a2f3d8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-builds.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueBuilds( + health.WithGetQueueBuildsThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..473d953c15 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-certificates.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueCertificates( + health.WithGetQueueCertificatesThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..83eb8584a5 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-databases.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueDatabases( + health.WithGetQueueDatabasesName("<NAME>"), + health.WithGetQueueDatabasesThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..e491446f94 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-deletes.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueDeletes( + health.WithGetQueueDeletesThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..c7cf45a355 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-functions.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueFunctions( + health.WithGetQueueFunctionsThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..b369c24277 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-logs.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueLogs( + health.WithGetQueueLogsThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..cc944d0cad --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-mails.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueMails( + health.WithGetQueueMailsThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..65c6c34610 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-messaging.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueMessaging( + health.WithGetQueueMessagingThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..d0c3bd2573 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-migrations.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueMigrations( + health.WithGetQueueMigrationsThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..5ed004c7cf --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-stats-resources.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueStatsResources( + health.WithGetQueueStatsResourcesThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..5202371d1e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-usage.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueUsage( + health.WithGetQueueUsageThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-go/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..4782aef9ac --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-queue-webhooks.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetQueueWebhooks( + health.WithGetQueueWebhooksThreshold(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-go/examples/health/get-storage-local.md new file mode 100644 index 0000000000..e58b944497 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-storage-local.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetStorageLocal( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-storage.md b/docs/examples/1.7.x/server-go/examples/health/get-storage.md new file mode 100644 index 0000000000..73ae964d51 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-storage.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetStorage( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get-time.md b/docs/examples/1.7.x/server-go/examples/health/get-time.md new file mode 100644 index 0000000000..43c0ca46a4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get-time.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.GetTime( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/health/get.md b/docs/examples/1.7.x/server-go/examples/health/get.md new file mode 100644 index 0000000000..c9730f70dd --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/health/get.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/health" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := health.NewHealth(client) + response, error := service.Get( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/locale/get.md b/docs/examples/1.7.x/server-go/examples/locale/get.md new file mode 100644 index 0000000000..055889b6ce --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/locale/get.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/locale" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := locale.NewLocale(client) + response, error := service.Get( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/locale/list-codes.md b/docs/examples/1.7.x/server-go/examples/locale/list-codes.md new file mode 100644 index 0000000000..a69a05d6cd --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/locale/list-codes.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/locale" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := locale.NewLocale(client) + response, error := service.ListCodes( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/locale/list-continents.md b/docs/examples/1.7.x/server-go/examples/locale/list-continents.md new file mode 100644 index 0000000000..0430fdbe99 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/locale/list-continents.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/locale" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := locale.NewLocale(client) + response, error := service.ListContinents( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-go/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..92bd24d1f8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/locale/list-countries-e-u.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/locale" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := locale.NewLocale(client) + response, error := service.ListCountriesEU( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-go/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..1615834103 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/locale/list-countries-phones.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/locale" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := locale.NewLocale(client) + response, error := service.ListCountriesPhones( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/locale/list-countries.md b/docs/examples/1.7.x/server-go/examples/locale/list-countries.md new file mode 100644 index 0000000000..25bbbd1538 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/locale/list-countries.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/locale" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := locale.NewLocale(client) + response, error := service.ListCountries( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-go/examples/locale/list-currencies.md new file mode 100644 index 0000000000..e4bde5d9d9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/locale/list-currencies.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/locale" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := locale.NewLocale(client) + response, error := service.ListCurrencies( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/locale/list-languages.md b/docs/examples/1.7.x/server-go/examples/locale/list-languages.md new file mode 100644 index 0000000000..acce3181be --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/locale/list-languages.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/locale" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := locale.NewLocale(client) + response, error := service.ListLanguages( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..620219e07d --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-apns-provider.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateApnsProvider( + "<PROVIDER_ID>", + "<NAME>", + messaging.WithCreateApnsProviderAuthKey("<AUTH_KEY>"), + messaging.WithCreateApnsProviderAuthKeyId("<AUTH_KEY_ID>"), + messaging.WithCreateApnsProviderTeamId("<TEAM_ID>"), + messaging.WithCreateApnsProviderBundleId("<BUNDLE_ID>"), + messaging.WithCreateApnsProviderSandbox(false), + messaging.WithCreateApnsProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-email.md b/docs/examples/1.7.x/server-go/examples/messaging/create-email.md new file mode 100644 index 0000000000..3da6c88cf4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-email.md @@ -0,0 +1,37 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateEmail( + "<MESSAGE_ID>", + "<SUBJECT>", + "<CONTENT>", + messaging.WithCreateEmailTopics([]interface{}{}), + messaging.WithCreateEmailUsers([]interface{}{}), + messaging.WithCreateEmailTargets([]interface{}{}), + messaging.WithCreateEmailCc([]interface{}{}), + messaging.WithCreateEmailBcc([]interface{}{}), + messaging.WithCreateEmailAttachments([]interface{}{}), + messaging.WithCreateEmailDraft(false), + messaging.WithCreateEmailHtml(false), + messaging.WithCreateEmailScheduledAt(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..c70c340eb5 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-fcm-provider.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateFcmProvider( + "<PROVIDER_ID>", + "<NAME>", + messaging.WithCreateFcmProviderServiceAccountJSON(map[string]interface{}{}), + messaging.WithCreateFcmProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..e265218ef4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,35 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateMailgunProvider( + "<PROVIDER_ID>", + "<NAME>", + messaging.WithCreateMailgunProviderApiKey("<API_KEY>"), + messaging.WithCreateMailgunProviderDomain("<DOMAIN>"), + messaging.WithCreateMailgunProviderIsEuRegion(false), + messaging.WithCreateMailgunProviderFromName("<FROM_NAME>"), + messaging.WithCreateMailgunProviderFromEmail("email@example.com"), + messaging.WithCreateMailgunProviderReplyToName("<REPLY_TO_NAME>"), + messaging.WithCreateMailgunProviderReplyToEmail("email@example.com"), + messaging.WithCreateMailgunProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..53660cbfa0 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-msg91provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateMsg91Provider( + "<PROVIDER_ID>", + "<NAME>", + messaging.WithCreateMsg91ProviderTemplateId("<TEMPLATE_ID>"), + messaging.WithCreateMsg91ProviderSenderId("<SENDER_ID>"), + messaging.WithCreateMsg91ProviderAuthKey("<AUTH_KEY>"), + messaging.WithCreateMsg91ProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-push.md b/docs/examples/1.7.x/server-go/examples/messaging/create-push.md new file mode 100644 index 0000000000..214d6ae0ed --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-push.md @@ -0,0 +1,44 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreatePush( + "<MESSAGE_ID>", + messaging.WithCreatePushTitle("<TITLE>"), + messaging.WithCreatePushBody("<BODY>"), + messaging.WithCreatePushTopics([]interface{}{}), + messaging.WithCreatePushUsers([]interface{}{}), + messaging.WithCreatePushTargets([]interface{}{}), + messaging.WithCreatePushData(map[string]interface{}{}), + messaging.WithCreatePushAction("<ACTION>"), + messaging.WithCreatePushImage("[ID1:ID2]"), + messaging.WithCreatePushIcon("<ICON>"), + messaging.WithCreatePushSound("<SOUND>"), + messaging.WithCreatePushColor("<COLOR>"), + messaging.WithCreatePushTag("<TAG>"), + messaging.WithCreatePushBadge(0), + messaging.WithCreatePushDraft(false), + messaging.WithCreatePushScheduledAt(""), + messaging.WithCreatePushContentAvailable(false), + messaging.WithCreatePushCritical(false), + messaging.WithCreatePushPriority("normal"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..69375a23ca --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateSendgridProvider( + "<PROVIDER_ID>", + "<NAME>", + messaging.WithCreateSendgridProviderApiKey("<API_KEY>"), + messaging.WithCreateSendgridProviderFromName("<FROM_NAME>"), + messaging.WithCreateSendgridProviderFromEmail("email@example.com"), + messaging.WithCreateSendgridProviderReplyToName("<REPLY_TO_NAME>"), + messaging.WithCreateSendgridProviderReplyToEmail("email@example.com"), + messaging.WithCreateSendgridProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-go/examples/messaging/create-sms.md new file mode 100644 index 0000000000..95c7738969 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-sms.md @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateSms( + "<MESSAGE_ID>", + "<CONTENT>", + messaging.WithCreateSmsTopics([]interface{}{}), + messaging.WithCreateSmsUsers([]interface{}{}), + messaging.WithCreateSmsTargets([]interface{}{}), + messaging.WithCreateSmsDraft(false), + messaging.WithCreateSmsScheduledAt(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..4c88b4ef7a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-smtp-provider.md @@ -0,0 +1,39 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateSmtpProvider( + "<PROVIDER_ID>", + "<NAME>", + "<HOST>", + messaging.WithCreateSmtpProviderPort(1), + messaging.WithCreateSmtpProviderUsername("<USERNAME>"), + messaging.WithCreateSmtpProviderPassword("<PASSWORD>"), + messaging.WithCreateSmtpProviderEncryption("none"), + messaging.WithCreateSmtpProviderAutoTLS(false), + messaging.WithCreateSmtpProviderMailer("<MAILER>"), + messaging.WithCreateSmtpProviderFromName("<FROM_NAME>"), + messaging.WithCreateSmtpProviderFromEmail("email@example.com"), + messaging.WithCreateSmtpProviderReplyToName("<REPLY_TO_NAME>"), + messaging.WithCreateSmtpProviderReplyToEmail("email@example.com"), + messaging.WithCreateSmtpProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-go/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..c4faa8544a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-subscriber.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetJWT("<YOUR_JWT>") // Your secret JSON Web Token + + service := messaging.NewMessaging(client) + response, error := service.CreateSubscriber( + "<TOPIC_ID>", + "<SUBSCRIBER_ID>", + "<TARGET_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..11dd8c9bc6 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-telesign-provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateTelesignProvider( + "<PROVIDER_ID>", + "<NAME>", + messaging.WithCreateTelesignProviderFrom("+12065550100"), + messaging.WithCreateTelesignProviderCustomerId("<CUSTOMER_ID>"), + messaging.WithCreateTelesignProviderApiKey("<API_KEY>"), + messaging.WithCreateTelesignProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..a036549240 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateTextmagicProvider( + "<PROVIDER_ID>", + "<NAME>", + messaging.WithCreateTextmagicProviderFrom("+12065550100"), + messaging.WithCreateTextmagicProviderUsername("<USERNAME>"), + messaging.WithCreateTextmagicProviderApiKey("<API_KEY>"), + messaging.WithCreateTextmagicProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-go/examples/messaging/create-topic.md new file mode 100644 index 0000000000..0453089fbc --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-topic.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateTopic( + "<TOPIC_ID>", + "<NAME>", + messaging.WithCreateTopicSubscribe(interface{}{"any"}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..cd8a993a6c --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-twilio-provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateTwilioProvider( + "<PROVIDER_ID>", + "<NAME>", + messaging.WithCreateTwilioProviderFrom("+12065550100"), + messaging.WithCreateTwilioProviderAccountSid("<ACCOUNT_SID>"), + messaging.WithCreateTwilioProviderAuthToken("<AUTH_TOKEN>"), + messaging.WithCreateTwilioProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..e17e8d885b --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/create-vonage-provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.CreateVonageProvider( + "<PROVIDER_ID>", + "<NAME>", + messaging.WithCreateVonageProviderFrom("+12065550100"), + messaging.WithCreateVonageProviderApiKey("<API_KEY>"), + messaging.WithCreateVonageProviderApiSecret("<API_SECRET>"), + messaging.WithCreateVonageProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..2c5b77d622 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/delete-provider.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.DeleteProvider( + "<PROVIDER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-go/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..fec03f53f7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/delete-subscriber.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetJWT("<YOUR_JWT>") // Your secret JSON Web Token + + service := messaging.NewMessaging(client) + response, error := service.DeleteSubscriber( + "<TOPIC_ID>", + "<SUBSCRIBER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-go/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..3a9787b6ce --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/delete-topic.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.DeleteTopic( + "<TOPIC_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/delete.md b/docs/examples/1.7.x/server-go/examples/messaging/delete.md new file mode 100644 index 0000000000..4d5accd22f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/delete.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.Delete( + "<MESSAGE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/get-message.md b/docs/examples/1.7.x/server-go/examples/messaging/get-message.md new file mode 100644 index 0000000000..d6db3188c8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/get-message.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.GetMessage( + "<MESSAGE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/get-provider.md new file mode 100644 index 0000000000..ff2bab3acf --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/get-provider.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.GetProvider( + "<PROVIDER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-go/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..47fccf23cd --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/get-subscriber.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.GetSubscriber( + "<TOPIC_ID>", + "<SUBSCRIBER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-go/examples/messaging/get-topic.md new file mode 100644 index 0000000000..a332f55ba4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/get-topic.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.GetTopic( + "<TOPIC_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-go/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..b4a5528b41 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/list-message-logs.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.ListMessageLogs( + "<MESSAGE_ID>", + messaging.WithListMessageLogsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-go/examples/messaging/list-messages.md new file mode 100644 index 0000000000..f1ca97d3fe --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/list-messages.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.ListMessages( + messaging.WithListMessagesQueries([]interface{}{}), + messaging.WithListMessagesSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-go/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..945dbcfd4e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/list-provider-logs.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.ListProviderLogs( + "<PROVIDER_ID>", + messaging.WithListProviderLogsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-go/examples/messaging/list-providers.md new file mode 100644 index 0000000000..57c09a2061 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/list-providers.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.ListProviders( + messaging.WithListProvidersQueries([]interface{}{}), + messaging.WithListProvidersSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-go/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..cb2f050dd9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.ListSubscriberLogs( + "<SUBSCRIBER_ID>", + messaging.WithListSubscriberLogsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-go/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..045777d8c4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/list-subscribers.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.ListSubscribers( + "<TOPIC_ID>", + messaging.WithListSubscribersQueries([]interface{}{}), + messaging.WithListSubscribersSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-go/examples/messaging/list-targets.md new file mode 100644 index 0000000000..9cc65e0d1c --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/list-targets.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.ListTargets( + "<MESSAGE_ID>", + messaging.WithListTargetsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-go/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..2e928dbfc7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/list-topic-logs.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.ListTopicLogs( + "<TOPIC_ID>", + messaging.WithListTopicLogsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-go/examples/messaging/list-topics.md new file mode 100644 index 0000000000..69574ae02f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/list-topics.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.ListTopics( + messaging.WithListTopicsQueries([]interface{}{}), + messaging.WithListTopicsSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..aac3e39c6e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-apns-provider.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateApnsProvider( + "<PROVIDER_ID>", + messaging.WithUpdateApnsProviderName("<NAME>"), + messaging.WithUpdateApnsProviderEnabled(false), + messaging.WithUpdateApnsProviderAuthKey("<AUTH_KEY>"), + messaging.WithUpdateApnsProviderAuthKeyId("<AUTH_KEY_ID>"), + messaging.WithUpdateApnsProviderTeamId("<TEAM_ID>"), + messaging.WithUpdateApnsProviderBundleId("<BUNDLE_ID>"), + messaging.WithUpdateApnsProviderSandbox(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-email.md b/docs/examples/1.7.x/server-go/examples/messaging/update-email.md new file mode 100644 index 0000000000..f1e9f081d2 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-email.md @@ -0,0 +1,37 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateEmail( + "<MESSAGE_ID>", + messaging.WithUpdateEmailTopics([]interface{}{}), + messaging.WithUpdateEmailUsers([]interface{}{}), + messaging.WithUpdateEmailTargets([]interface{}{}), + messaging.WithUpdateEmailSubject("<SUBJECT>"), + messaging.WithUpdateEmailContent("<CONTENT>"), + messaging.WithUpdateEmailDraft(false), + messaging.WithUpdateEmailHtml(false), + messaging.WithUpdateEmailCc([]interface{}{}), + messaging.WithUpdateEmailBcc([]interface{}{}), + messaging.WithUpdateEmailScheduledAt(""), + messaging.WithUpdateEmailAttachments([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..55e4b90363 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-fcm-provider.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateFcmProvider( + "<PROVIDER_ID>", + messaging.WithUpdateFcmProviderName("<NAME>"), + messaging.WithUpdateFcmProviderEnabled(false), + messaging.WithUpdateFcmProviderServiceAccountJSON(map[string]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..5bb229f348 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,35 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateMailgunProvider( + "<PROVIDER_ID>", + messaging.WithUpdateMailgunProviderName("<NAME>"), + messaging.WithUpdateMailgunProviderApiKey("<API_KEY>"), + messaging.WithUpdateMailgunProviderDomain("<DOMAIN>"), + messaging.WithUpdateMailgunProviderIsEuRegion(false), + messaging.WithUpdateMailgunProviderEnabled(false), + messaging.WithUpdateMailgunProviderFromName("<FROM_NAME>"), + messaging.WithUpdateMailgunProviderFromEmail("email@example.com"), + messaging.WithUpdateMailgunProviderReplyToName("<REPLY_TO_NAME>"), + messaging.WithUpdateMailgunProviderReplyToEmail("<REPLY_TO_EMAIL>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..d19c500262 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-msg91provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateMsg91Provider( + "<PROVIDER_ID>", + messaging.WithUpdateMsg91ProviderName("<NAME>"), + messaging.WithUpdateMsg91ProviderEnabled(false), + messaging.WithUpdateMsg91ProviderTemplateId("<TEMPLATE_ID>"), + messaging.WithUpdateMsg91ProviderSenderId("<SENDER_ID>"), + messaging.WithUpdateMsg91ProviderAuthKey("<AUTH_KEY>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-push.md b/docs/examples/1.7.x/server-go/examples/messaging/update-push.md new file mode 100644 index 0000000000..856b95dc1b --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-push.md @@ -0,0 +1,44 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdatePush( + "<MESSAGE_ID>", + messaging.WithUpdatePushTopics([]interface{}{}), + messaging.WithUpdatePushUsers([]interface{}{}), + messaging.WithUpdatePushTargets([]interface{}{}), + messaging.WithUpdatePushTitle("<TITLE>"), + messaging.WithUpdatePushBody("<BODY>"), + messaging.WithUpdatePushData(map[string]interface{}{}), + messaging.WithUpdatePushAction("<ACTION>"), + messaging.WithUpdatePushImage("[ID1:ID2]"), + messaging.WithUpdatePushIcon("<ICON>"), + messaging.WithUpdatePushSound("<SOUND>"), + messaging.WithUpdatePushColor("<COLOR>"), + messaging.WithUpdatePushTag("<TAG>"), + messaging.WithUpdatePushBadge(0), + messaging.WithUpdatePushDraft(false), + messaging.WithUpdatePushScheduledAt(""), + messaging.WithUpdatePushContentAvailable(false), + messaging.WithUpdatePushCritical(false), + messaging.WithUpdatePushPriority("normal"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..5742b44874 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateSendgridProvider( + "<PROVIDER_ID>", + messaging.WithUpdateSendgridProviderName("<NAME>"), + messaging.WithUpdateSendgridProviderEnabled(false), + messaging.WithUpdateSendgridProviderApiKey("<API_KEY>"), + messaging.WithUpdateSendgridProviderFromName("<FROM_NAME>"), + messaging.WithUpdateSendgridProviderFromEmail("email@example.com"), + messaging.WithUpdateSendgridProviderReplyToName("<REPLY_TO_NAME>"), + messaging.WithUpdateSendgridProviderReplyToEmail("<REPLY_TO_EMAIL>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-go/examples/messaging/update-sms.md new file mode 100644 index 0000000000..09b3456d38 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-sms.md @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateSms( + "<MESSAGE_ID>", + messaging.WithUpdateSmsTopics([]interface{}{}), + messaging.WithUpdateSmsUsers([]interface{}{}), + messaging.WithUpdateSmsTargets([]interface{}{}), + messaging.WithUpdateSmsContent("<CONTENT>"), + messaging.WithUpdateSmsDraft(false), + messaging.WithUpdateSmsScheduledAt(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..b99f86e123 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-smtp-provider.md @@ -0,0 +1,39 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateSmtpProvider( + "<PROVIDER_ID>", + messaging.WithUpdateSmtpProviderName("<NAME>"), + messaging.WithUpdateSmtpProviderHost("<HOST>"), + messaging.WithUpdateSmtpProviderPort(1), + messaging.WithUpdateSmtpProviderUsername("<USERNAME>"), + messaging.WithUpdateSmtpProviderPassword("<PASSWORD>"), + messaging.WithUpdateSmtpProviderEncryption("none"), + messaging.WithUpdateSmtpProviderAutoTLS(false), + messaging.WithUpdateSmtpProviderMailer("<MAILER>"), + messaging.WithUpdateSmtpProviderFromName("<FROM_NAME>"), + messaging.WithUpdateSmtpProviderFromEmail("email@example.com"), + messaging.WithUpdateSmtpProviderReplyToName("<REPLY_TO_NAME>"), + messaging.WithUpdateSmtpProviderReplyToEmail("<REPLY_TO_EMAIL>"), + messaging.WithUpdateSmtpProviderEnabled(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..5fb99a68ec --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-telesign-provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateTelesignProvider( + "<PROVIDER_ID>", + messaging.WithUpdateTelesignProviderName("<NAME>"), + messaging.WithUpdateTelesignProviderEnabled(false), + messaging.WithUpdateTelesignProviderCustomerId("<CUSTOMER_ID>"), + messaging.WithUpdateTelesignProviderApiKey("<API_KEY>"), + messaging.WithUpdateTelesignProviderFrom("<FROM>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..24e619cc7f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateTextmagicProvider( + "<PROVIDER_ID>", + messaging.WithUpdateTextmagicProviderName("<NAME>"), + messaging.WithUpdateTextmagicProviderEnabled(false), + messaging.WithUpdateTextmagicProviderUsername("<USERNAME>"), + messaging.WithUpdateTextmagicProviderApiKey("<API_KEY>"), + messaging.WithUpdateTextmagicProviderFrom("<FROM>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-go/examples/messaging/update-topic.md new file mode 100644 index 0000000000..ab8902b4b2 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-topic.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateTopic( + "<TOPIC_ID>", + messaging.WithUpdateTopicName("<NAME>"), + messaging.WithUpdateTopicSubscribe(interface{}{"any"}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..316a2516d1 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-twilio-provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateTwilioProvider( + "<PROVIDER_ID>", + messaging.WithUpdateTwilioProviderName("<NAME>"), + messaging.WithUpdateTwilioProviderEnabled(false), + messaging.WithUpdateTwilioProviderAccountSid("<ACCOUNT_SID>"), + messaging.WithUpdateTwilioProviderAuthToken("<AUTH_TOKEN>"), + messaging.WithUpdateTwilioProviderFrom("<FROM>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-go/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..d17452140a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/messaging/update-vonage-provider.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/messaging" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := messaging.NewMessaging(client) + response, error := service.UpdateVonageProvider( + "<PROVIDER_ID>", + messaging.WithUpdateVonageProviderName("<NAME>"), + messaging.WithUpdateVonageProviderEnabled(false), + messaging.WithUpdateVonageProviderApiKey("<API_KEY>"), + messaging.WithUpdateVonageProviderApiSecret("<API_SECRET>"), + messaging.WithUpdateVonageProviderFrom("<FROM>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-go/examples/sites/create-deployment.md new file mode 100644 index 0000000000..0e97c8083a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/create-deployment.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.CreateDeployment( + "<SITE_ID>", + file.NewInputFile("/path/to/file.png", "file.png"), + false, + sites.WithCreateDeploymentInstallCommand("<INSTALL_COMMAND>"), + sites.WithCreateDeploymentBuildCommand("<BUILD_COMMAND>"), + sites.WithCreateDeploymentOutputDirectory("<OUTPUT_DIRECTORY>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-go/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..a128fda185 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.CreateDuplicateDeployment( + "<SITE_ID>", + "<DEPLOYMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-go/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..2c1e8fb5c5 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/create-template-deployment.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.CreateTemplateDeployment( + "<SITE_ID>", + "<REPOSITORY>", + "<OWNER>", + "<ROOT_DIRECTORY>", + "<VERSION>", + sites.WithCreateTemplateDeploymentActivate(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/create-variable.md b/docs/examples/1.7.x/server-go/examples/sites/create-variable.md new file mode 100644 index 0000000000..1660ad24a1 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/create-variable.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.CreateVariable( + "<SITE_ID>", + "<KEY>", + "<VALUE>", + sites.WithCreateVariableSecret(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-go/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..2135f71edb --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/create-vcs-deployment.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.CreateVcsDeployment( + "<SITE_ID>", + "branch", + "<REFERENCE>", + sites.WithCreateVcsDeploymentActivate(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/create.md b/docs/examples/1.7.x/server-go/examples/sites/create.md new file mode 100644 index 0000000000..c683404d86 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/create.md @@ -0,0 +1,43 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.Create( + "<SITE_ID>", + "<NAME>", + "analog", + "node-14.5", + sites.WithCreateEnabled(false), + sites.WithCreateLogging(false), + sites.WithCreateTimeout(1), + sites.WithCreateInstallCommand("<INSTALL_COMMAND>"), + sites.WithCreateBuildCommand("<BUILD_COMMAND>"), + sites.WithCreateOutputDirectory("<OUTPUT_DIRECTORY>"), + sites.WithCreateAdapter("static"), + sites.WithCreateInstallationId("<INSTALLATION_ID>"), + sites.WithCreateFallbackFile("<FALLBACK_FILE>"), + sites.WithCreateProviderRepositoryId("<PROVIDER_REPOSITORY_ID>"), + sites.WithCreateProviderBranch("<PROVIDER_BRANCH>"), + sites.WithCreateProviderSilentMode(false), + sites.WithCreateProviderRootDirectory("<PROVIDER_ROOT_DIRECTORY>"), + sites.WithCreateSpecification(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-go/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..83daf67634 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/delete-deployment.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.DeleteDeployment( + "<SITE_ID>", + "<DEPLOYMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/delete-log.md b/docs/examples/1.7.x/server-go/examples/sites/delete-log.md new file mode 100644 index 0000000000..6f17e84dc4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/delete-log.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.DeleteLog( + "<SITE_ID>", + "<LOG_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-go/examples/sites/delete-variable.md new file mode 100644 index 0000000000..80f8b7cda9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/delete-variable.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.DeleteVariable( + "<SITE_ID>", + "<VARIABLE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/delete.md b/docs/examples/1.7.x/server-go/examples/sites/delete.md new file mode 100644 index 0000000000..4015d9c51e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/delete.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.Delete( + "<SITE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-go/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..1e97fba0c6 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/get-deployment-download.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.GetDeploymentDownload( + "<SITE_ID>", + "<DEPLOYMENT_ID>", + sites.WithGetDeploymentDownloadType("source"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-go/examples/sites/get-deployment.md new file mode 100644 index 0000000000..cf4be1f92e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/get-deployment.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.GetDeployment( + "<SITE_ID>", + "<DEPLOYMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/get-log.md b/docs/examples/1.7.x/server-go/examples/sites/get-log.md new file mode 100644 index 0000000000..2b19b2b8a8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/get-log.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.GetLog( + "<SITE_ID>", + "<LOG_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/get-variable.md b/docs/examples/1.7.x/server-go/examples/sites/get-variable.md new file mode 100644 index 0000000000..6c8395a5db --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/get-variable.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.GetVariable( + "<SITE_ID>", + "<VARIABLE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/get.md b/docs/examples/1.7.x/server-go/examples/sites/get.md new file mode 100644 index 0000000000..a2fae14dff --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/get.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.Get( + "<SITE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-go/examples/sites/list-deployments.md new file mode 100644 index 0000000000..f81580f39f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/list-deployments.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.ListDeployments( + "<SITE_ID>", + sites.WithListDeploymentsQueries([]interface{}{}), + sites.WithListDeploymentsSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-go/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..c134c0bf40 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/list-frameworks.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.ListFrameworks( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/list-logs.md b/docs/examples/1.7.x/server-go/examples/sites/list-logs.md new file mode 100644 index 0000000000..7d7a841b64 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/list-logs.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.ListLogs( + "<SITE_ID>", + sites.WithListLogsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-go/examples/sites/list-specifications.md new file mode 100644 index 0000000000..4136f61881 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/list-specifications.md @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.ListSpecifications( + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/list-variables.md b/docs/examples/1.7.x/server-go/examples/sites/list-variables.md new file mode 100644 index 0000000000..e3070ad75b --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/list-variables.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.ListVariables( + "<SITE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/list.md b/docs/examples/1.7.x/server-go/examples/sites/list.md new file mode 100644 index 0000000000..d879280802 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/list.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.List( + sites.WithListQueries([]interface{}{}), + sites.WithListSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-go/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..efb388e3c6 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/update-deployment-status.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.UpdateDeploymentStatus( + "<SITE_ID>", + "<DEPLOYMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-go/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..5904a76a74 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/update-site-deployment.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.UpdateSiteDeployment( + "<SITE_ID>", + "<DEPLOYMENT_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/update-variable.md b/docs/examples/1.7.x/server-go/examples/sites/update-variable.md new file mode 100644 index 0000000000..d50fe8c046 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/update-variable.md @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.UpdateVariable( + "<SITE_ID>", + "<VARIABLE_ID>", + "<KEY>", + sites.WithUpdateVariableValue("<VALUE>"), + sites.WithUpdateVariableSecret(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/sites/update.md b/docs/examples/1.7.x/server-go/examples/sites/update.md new file mode 100644 index 0000000000..4001eb4f48 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/sites/update.md @@ -0,0 +1,43 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/sites" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := sites.NewSites(client) + response, error := service.Update( + "<SITE_ID>", + "<NAME>", + "analog", + sites.WithUpdateEnabled(false), + sites.WithUpdateLogging(false), + sites.WithUpdateTimeout(1), + sites.WithUpdateInstallCommand("<INSTALL_COMMAND>"), + sites.WithUpdateBuildCommand("<BUILD_COMMAND>"), + sites.WithUpdateOutputDirectory("<OUTPUT_DIRECTORY>"), + sites.WithUpdateBuildRuntime("node-14.5"), + sites.WithUpdateAdapter("static"), + sites.WithUpdateFallbackFile("<FALLBACK_FILE>"), + sites.WithUpdateInstallationId("<INSTALLATION_ID>"), + sites.WithUpdateProviderRepositoryId("<PROVIDER_REPOSITORY_ID>"), + sites.WithUpdateProviderBranch("<PROVIDER_BRANCH>"), + sites.WithUpdateProviderSilentMode(false), + sites.WithUpdateProviderRootDirectory("<PROVIDER_ROOT_DIRECTORY>"), + sites.WithUpdateSpecification(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-go/examples/storage/create-bucket.md new file mode 100644 index 0000000000..39dc1d06d9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/create-bucket.md @@ -0,0 +1,35 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := storage.NewStorage(client) + response, error := service.CreateBucket( + "<BUCKET_ID>", + "<NAME>", + storage.WithCreateBucketPermissions(interface{}{"read("any")"}), + storage.WithCreateBucketFileSecurity(false), + storage.WithCreateBucketEnabled(false), + storage.WithCreateBucketMaximumFileSize(1), + storage.WithCreateBucketAllowedFileExtensions([]interface{}{}), + storage.WithCreateBucketCompression("none"), + storage.WithCreateBucketEncryption(false), + storage.WithCreateBucketAntivirus(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/create-file.md b/docs/examples/1.7.x/server-go/examples/storage/create-file.md new file mode 100644 index 0000000000..1ca815c92e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/create-file.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := storage.NewStorage(client) + response, error := service.CreateFile( + "<BUCKET_ID>", + "<FILE_ID>", + file.NewInputFile("/path/to/file.png", "file.png"), + storage.WithCreateFilePermissions(interface{}{"read("any")"}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-go/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..37a3f69b25 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/delete-bucket.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := storage.NewStorage(client) + response, error := service.DeleteBucket( + "<BUCKET_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/delete-file.md b/docs/examples/1.7.x/server-go/examples/storage/delete-file.md new file mode 100644 index 0000000000..522aacae72 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/delete-file.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := storage.NewStorage(client) + response, error := service.DeleteFile( + "<BUCKET_ID>", + "<FILE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-go/examples/storage/get-bucket.md new file mode 100644 index 0000000000..b76ac37d25 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/get-bucket.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := storage.NewStorage(client) + response, error := service.GetBucket( + "<BUCKET_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-go/examples/storage/get-file-download.md new file mode 100644 index 0000000000..9aa461de89 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/get-file-download.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := storage.NewStorage(client) + response, error := service.GetFileDownload( + "<BUCKET_ID>", + "<FILE_ID>", + storage.WithGetFileDownloadToken("<TOKEN>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-go/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..511cad1325 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/get-file-preview.md @@ -0,0 +1,39 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := storage.NewStorage(client) + response, error := service.GetFilePreview( + "<BUCKET_ID>", + "<FILE_ID>", + storage.WithGetFilePreviewWidth(0), + storage.WithGetFilePreviewHeight(0), + storage.WithGetFilePreviewGravity("center"), + storage.WithGetFilePreviewQuality(-1), + storage.WithGetFilePreviewBorderWidth(0), + storage.WithGetFilePreviewBorderColor(""), + storage.WithGetFilePreviewBorderRadius(0), + storage.WithGetFilePreviewOpacity(0), + storage.WithGetFilePreviewRotation(-360), + storage.WithGetFilePreviewBackground(""), + storage.WithGetFilePreviewOutput("jpg"), + storage.WithGetFilePreviewToken("<TOKEN>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-go/examples/storage/get-file-view.md new file mode 100644 index 0000000000..5832517534 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/get-file-view.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := storage.NewStorage(client) + response, error := service.GetFileView( + "<BUCKET_ID>", + "<FILE_ID>", + storage.WithGetFileViewToken("<TOKEN>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/get-file.md b/docs/examples/1.7.x/server-go/examples/storage/get-file.md new file mode 100644 index 0000000000..824c86f054 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/get-file.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := storage.NewStorage(client) + response, error := service.GetFile( + "<BUCKET_ID>", + "<FILE_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-go/examples/storage/list-buckets.md new file mode 100644 index 0000000000..00dd8d657b --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/list-buckets.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := storage.NewStorage(client) + response, error := service.ListBuckets( + storage.WithListBucketsQueries([]interface{}{}), + storage.WithListBucketsSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/list-files.md b/docs/examples/1.7.x/server-go/examples/storage/list-files.md new file mode 100644 index 0000000000..a84dfac6fd --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/list-files.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := storage.NewStorage(client) + response, error := service.ListFiles( + "<BUCKET_ID>", + storage.WithListFilesQueries([]interface{}{}), + storage.WithListFilesSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-go/examples/storage/update-bucket.md new file mode 100644 index 0000000000..58efff687b --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/update-bucket.md @@ -0,0 +1,35 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := storage.NewStorage(client) + response, error := service.UpdateBucket( + "<BUCKET_ID>", + "<NAME>", + storage.WithUpdateBucketPermissions(interface{}{"read("any")"}), + storage.WithUpdateBucketFileSecurity(false), + storage.WithUpdateBucketEnabled(false), + storage.WithUpdateBucketMaximumFileSize(1), + storage.WithUpdateBucketAllowedFileExtensions([]interface{}{}), + storage.WithUpdateBucketCompression("none"), + storage.WithUpdateBucketEncryption(false), + storage.WithUpdateBucketAntivirus(false), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/storage/update-file.md b/docs/examples/1.7.x/server-go/examples/storage/update-file.md new file mode 100644 index 0000000000..f1705138e9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/storage/update-file.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/storage" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := storage.NewStorage(client) + response, error := service.UpdateFile( + "<BUCKET_ID>", + "<FILE_ID>", + storage.WithUpdateFileName("<NAME>"), + storage.WithUpdateFilePermissions(interface{}{"read("any")"}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/create-membership.md b/docs/examples/1.7.x/server-go/examples/teams/create-membership.md new file mode 100644 index 0000000000..90c3d82348 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/create-membership.md @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.CreateMembership( + "<TEAM_ID>", + []interface{}{}, + teams.WithCreateMembershipEmail("email@example.com"), + teams.WithCreateMembershipUserId("<USER_ID>"), + teams.WithCreateMembershipPhone("+12065550100"), + teams.WithCreateMembershipUrl("https://example.com"), + teams.WithCreateMembershipName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/create.md b/docs/examples/1.7.x/server-go/examples/teams/create.md new file mode 100644 index 0000000000..1898936941 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/create.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.Create( + "<TEAM_ID>", + "<NAME>", + teams.WithCreateRoles([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-go/examples/teams/delete-membership.md new file mode 100644 index 0000000000..78810817a9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/delete-membership.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.DeleteMembership( + "<TEAM_ID>", + "<MEMBERSHIP_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/delete.md b/docs/examples/1.7.x/server-go/examples/teams/delete.md new file mode 100644 index 0000000000..fb4771605d --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/delete.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.Delete( + "<TEAM_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/get-membership.md b/docs/examples/1.7.x/server-go/examples/teams/get-membership.md new file mode 100644 index 0000000000..c61b9c57c3 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/get-membership.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.GetMembership( + "<TEAM_ID>", + "<MEMBERSHIP_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-go/examples/teams/get-prefs.md new file mode 100644 index 0000000000..c237cd144a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/get-prefs.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.GetPrefs( + "<TEAM_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/get.md b/docs/examples/1.7.x/server-go/examples/teams/get.md new file mode 100644 index 0000000000..c29e9fa786 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/get.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.Get( + "<TEAM_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-go/examples/teams/list-memberships.md new file mode 100644 index 0000000000..1e8fb45ca7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/list-memberships.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.ListMemberships( + "<TEAM_ID>", + teams.WithListMembershipsQueries([]interface{}{}), + teams.WithListMembershipsSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/list.md b/docs/examples/1.7.x/server-go/examples/teams/list.md new file mode 100644 index 0000000000..c4b109f1f3 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/list.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.List( + teams.WithListQueries([]interface{}{}), + teams.WithListSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-go/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..fbec3b8e84 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/update-membership-status.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.UpdateMembershipStatus( + "<TEAM_ID>", + "<MEMBERSHIP_ID>", + "<USER_ID>", + "<SECRET>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/update-membership.md b/docs/examples/1.7.x/server-go/examples/teams/update-membership.md new file mode 100644 index 0000000000..1b478a1913 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/update-membership.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.UpdateMembership( + "<TEAM_ID>", + "<MEMBERSHIP_ID>", + []interface{}{}, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/update-name.md b/docs/examples/1.7.x/server-go/examples/teams/update-name.md new file mode 100644 index 0000000000..a7b5da7c20 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/update-name.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.UpdateName( + "<TEAM_ID>", + "<NAME>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-go/examples/teams/update-prefs.md new file mode 100644 index 0000000000..6d395add21 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/teams/update-prefs.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/teams" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetSession("") // The user session to authenticate with + + service := teams.NewTeams(client) + response, error := service.UpdatePrefs( + "<TEAM_ID>", + map[string]interface{}{}, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-go/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..8343e3e077 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/tokens/create-file-token.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/tokens" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := tokens.NewTokens(client) + response, error := service.CreateFileToken( + "<BUCKET_ID>", + "<FILE_ID>", + tokens.WithCreateFileTokenExpire(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/tokens/delete.md b/docs/examples/1.7.x/server-go/examples/tokens/delete.md new file mode 100644 index 0000000000..73322e6c9b --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/tokens/delete.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/tokens" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := tokens.NewTokens(client) + response, error := service.Delete( + "<TOKEN_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/tokens/get.md b/docs/examples/1.7.x/server-go/examples/tokens/get.md new file mode 100644 index 0000000000..64b53a24b9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/tokens/get.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/tokens" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := tokens.NewTokens(client) + response, error := service.Get( + "<TOKEN_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/tokens/list.md b/docs/examples/1.7.x/server-go/examples/tokens/list.md new file mode 100644 index 0000000000..e4864cd74a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/tokens/list.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/tokens" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := tokens.NewTokens(client) + response, error := service.List( + "<BUCKET_ID>", + "<FILE_ID>", + tokens.WithListQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/tokens/update.md b/docs/examples/1.7.x/server-go/examples/tokens/update.md new file mode 100644 index 0000000000..94c30ece79 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/tokens/update.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/tokens" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := tokens.NewTokens(client) + response, error := service.Update( + "<TOKEN_ID>", + tokens.WithUpdateExpire(""), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-go/examples/users/create-argon2user.md new file mode 100644 index 0000000000..44eaafbcd4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-argon2user.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateArgon2User( + "<USER_ID>", + "email@example.com", + "password", + users.WithCreateArgon2UserName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-go/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..d818598c70 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-bcrypt-user.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateBcryptUser( + "<USER_ID>", + "email@example.com", + "password", + users.WithCreateBcryptUserName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-go/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..dc1e51b195 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-j-w-t.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateJWT( + "<USER_ID>", + users.WithCreateJWTSessionId("<SESSION_ID>"), + users.WithCreateJWTDuration(0), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-go/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..1dba39c5fd --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-m-d5user.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateMD5User( + "<USER_ID>", + "email@example.com", + "password", + users.WithCreateMD5UserName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-go/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..3078f0993b --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateMfaRecoveryCodes( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-go/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..c0380bd9f3 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-p-h-pass-user.md @@ -0,0 +1,29 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreatePHPassUser( + "<USER_ID>", + "email@example.com", + "password", + users.WithCreatePHPassUserName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-go/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..93aa77e853 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-s-h-a-user.md @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateSHAUser( + "<USER_ID>", + "email@example.com", + "password", + users.WithCreateSHAUserPasswordVersion("sha1"), + users.WithCreateSHAUserName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-go/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..cd48f6c83f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateScryptModifiedUser( + "<USER_ID>", + "email@example.com", + "password", + "<PASSWORD_SALT>", + "<PASSWORD_SALT_SEPARATOR>", + "<PASSWORD_SIGNER_KEY>", + users.WithCreateScryptModifiedUserName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-go/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..65d70e986f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-scrypt-user.md @@ -0,0 +1,34 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateScryptUser( + "<USER_ID>", + "email@example.com", + "password", + "<PASSWORD_SALT>", + 0, + 0, + 0, + 0, + users.WithCreateScryptUserName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-session.md b/docs/examples/1.7.x/server-go/examples/users/create-session.md new file mode 100644 index 0000000000..92304e647d --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-session.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateSession( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-target.md b/docs/examples/1.7.x/server-go/examples/users/create-target.md new file mode 100644 index 0000000000..db42e2c391 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-target.md @@ -0,0 +1,31 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateTarget( + "<USER_ID>", + "<TARGET_ID>", + "email", + "<IDENTIFIER>", + users.WithCreateTargetProviderId("<PROVIDER_ID>"), + users.WithCreateTargetName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create-token.md b/docs/examples/1.7.x/server-go/examples/users/create-token.md new file mode 100644 index 0000000000..6181a8d9d4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create-token.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.CreateToken( + "<USER_ID>", + users.WithCreateTokenLength(4), + users.WithCreateTokenExpire(60), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/create.md b/docs/examples/1.7.x/server-go/examples/users/create.md new file mode 100644 index 0000000000..0ab673bc73 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/create.md @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.Create( + "<USER_ID>", + users.WithCreateEmail("email@example.com"), + users.WithCreatePhone("+12065550100"), + users.WithCreatePassword(""), + users.WithCreateName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/delete-identity.md b/docs/examples/1.7.x/server-go/examples/users/delete-identity.md new file mode 100644 index 0000000000..1095a1763a --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/delete-identity.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.DeleteIdentity( + "<IDENTITY_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-go/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..d61c5db0c8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.DeleteMfaAuthenticator( + "<USER_ID>", + "totp", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/delete-session.md b/docs/examples/1.7.x/server-go/examples/users/delete-session.md new file mode 100644 index 0000000000..2a0de4c271 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/delete-session.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.DeleteSession( + "<USER_ID>", + "<SESSION_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-go/examples/users/delete-sessions.md new file mode 100644 index 0000000000..ea15501819 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/delete-sessions.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.DeleteSessions( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/delete-target.md b/docs/examples/1.7.x/server-go/examples/users/delete-target.md new file mode 100644 index 0000000000..d4cd4e51a8 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/delete-target.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.DeleteTarget( + "<USER_ID>", + "<TARGET_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/delete.md b/docs/examples/1.7.x/server-go/examples/users/delete.md new file mode 100644 index 0000000000..2c359e3ab0 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/delete.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.Delete( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-go/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..485075546f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.GetMfaRecoveryCodes( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/get-prefs.md b/docs/examples/1.7.x/server-go/examples/users/get-prefs.md new file mode 100644 index 0000000000..0dba272388 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/get-prefs.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.GetPrefs( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/get-target.md b/docs/examples/1.7.x/server-go/examples/users/get-target.md new file mode 100644 index 0000000000..b1291d7490 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/get-target.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.GetTarget( + "<USER_ID>", + "<TARGET_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/get.md b/docs/examples/1.7.x/server-go/examples/users/get.md new file mode 100644 index 0000000000..c6aae29d5d --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/get.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.Get( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/list-identities.md b/docs/examples/1.7.x/server-go/examples/users/list-identities.md new file mode 100644 index 0000000000..063b9100fb --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/list-identities.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.ListIdentities( + users.WithListIdentitiesQueries([]interface{}{}), + users.WithListIdentitiesSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/list-logs.md b/docs/examples/1.7.x/server-go/examples/users/list-logs.md new file mode 100644 index 0000000000..674668b965 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/list-logs.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.ListLogs( + "<USER_ID>", + users.WithListLogsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/list-memberships.md b/docs/examples/1.7.x/server-go/examples/users/list-memberships.md new file mode 100644 index 0000000000..08b9a884f4 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/list-memberships.md @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.ListMemberships( + "<USER_ID>", + users.WithListMembershipsQueries([]interface{}{}), + users.WithListMembershipsSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-go/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..1c39b87a66 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/list-mfa-factors.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.ListMfaFactors( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/list-sessions.md b/docs/examples/1.7.x/server-go/examples/users/list-sessions.md new file mode 100644 index 0000000000..835c23b1bc --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/list-sessions.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.ListSessions( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/list-targets.md b/docs/examples/1.7.x/server-go/examples/users/list-targets.md new file mode 100644 index 0000000000..84c2c312a9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/list-targets.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.ListTargets( + "<USER_ID>", + users.WithListTargetsQueries([]interface{}{}), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/list.md b/docs/examples/1.7.x/server-go/examples/users/list.md new file mode 100644 index 0000000000..247ad4c2e7 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/list.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.List( + users.WithListQueries([]interface{}{}), + users.WithListSearch("<SEARCH>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-go/examples/users/update-email-verification.md new file mode 100644 index 0000000000..70f5a10757 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-email-verification.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdateEmailVerification( + "<USER_ID>", + false, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-email.md b/docs/examples/1.7.x/server-go/examples/users/update-email.md new file mode 100644 index 0000000000..697783b967 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-email.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdateEmail( + "<USER_ID>", + "email@example.com", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-labels.md b/docs/examples/1.7.x/server-go/examples/users/update-labels.md new file mode 100644 index 0000000000..a65d2ead9d --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-labels.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdateLabels( + "<USER_ID>", + []interface{}{}, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-go/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..eb47e2ee09 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,26 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdateMfaRecoveryCodes( + "<USER_ID>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-mfa.md b/docs/examples/1.7.x/server-go/examples/users/update-mfa.md new file mode 100644 index 0000000000..756863799f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-mfa.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdateMfa( + "<USER_ID>", + false, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-name.md b/docs/examples/1.7.x/server-go/examples/users/update-name.md new file mode 100644 index 0000000000..8ef173c2e3 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-name.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdateName( + "<USER_ID>", + "<NAME>", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-password.md b/docs/examples/1.7.x/server-go/examples/users/update-password.md new file mode 100644 index 0000000000..2f9efac65f --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-password.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdatePassword( + "<USER_ID>", + "", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-go/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..c94fbd861e --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-phone-verification.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdatePhoneVerification( + "<USER_ID>", + false, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-phone.md b/docs/examples/1.7.x/server-go/examples/users/update-phone.md new file mode 100644 index 0000000000..77d20162f9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-phone.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdatePhone( + "<USER_ID>", + "+12065550100", + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-prefs.md b/docs/examples/1.7.x/server-go/examples/users/update-prefs.md new file mode 100644 index 0000000000..f7889a6337 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-prefs.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdatePrefs( + "<USER_ID>", + map[string]interface{}{}, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-status.md b/docs/examples/1.7.x/server-go/examples/users/update-status.md new file mode 100644 index 0000000000..2349e4e0c9 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-status.md @@ -0,0 +1,27 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdateStatus( + "<USER_ID>", + false, + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-go/examples/users/update-target.md b/docs/examples/1.7.x/server-go/examples/users/update-target.md new file mode 100644 index 0000000000..f8028b4483 --- /dev/null +++ b/docs/examples/1.7.x/server-go/examples/users/update-target.md @@ -0,0 +1,30 @@ +package main + +import ( + "fmt" + "github.com/appwrite/sdk-for-go/client" + "github.com/appwrite/sdk-for-go/users" +) + +func main() { + client := client.NewClient() + + client.SetEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + client.SetProject("<YOUR_PROJECT_ID>") // Your project ID + client.SetKey("<YOUR_API_KEY>") // Your secret API key + + service := users.NewUsers(client) + response, error := service.UpdateTarget( + "<USER_ID>", + "<TARGET_ID>", + users.WithUpdateTargetIdentifier("<IDENTIFIER>"), + users.WithUpdateTargetProviderId("<PROVIDER_ID>"), + users.WithUpdateTargetName("<NAME>"), + ) + + if error != nil { + panic(error) + } + + fmt.Println(response) +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-graphql/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..92c12acee5 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-anonymous-session.md @@ -0,0 +1,33 @@ +mutation { + accountCreateAnonymousSession { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-graphql/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..931bb4add0 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-email-password-session.md @@ -0,0 +1,36 @@ +mutation { + accountCreateEmailPasswordSession( + email: "email@example.com", + password: "password" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-email-token.md b/docs/examples/1.7.x/server-graphql/examples/account/create-email-token.md new file mode 100644 index 0000000000..de320b45ed --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-email-token.md @@ -0,0 +1,14 @@ +mutation { + accountCreateEmailToken( + userId: "<USER_ID>", + email: "email@example.com", + phrase: false + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-graphql/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..a5204f1256 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-j-w-t.md @@ -0,0 +1,5 @@ +mutation { + accountCreateJWT { + jwt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-graphql/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..4024a5b3a9 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,15 @@ +mutation { + accountCreateMagicURLToken( + userId: "<USER_ID>", + email: "email@example.com", + url: "https://example.com", + phrase: false + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-graphql/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..6b29292494 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-mfa-authenticator.md @@ -0,0 +1,8 @@ +mutation { + accountCreateMfaAuthenticator( + type: "totp" + ) { + secret + uri + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-graphql/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..eb5cba127d --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-mfa-challenge.md @@ -0,0 +1,10 @@ +mutation { + accountCreateMfaChallenge( + factor: "email" + ) { + _id + _createdAt + userId + expire + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-graphql/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..f39b7d080d --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,5 @@ +mutation { + accountCreateMfaRecoveryCodes { + recoveryCodes + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-graphql/examples/account/create-phone-token.md new file mode 100644 index 0000000000..b56c4eb4e4 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-phone-token.md @@ -0,0 +1,13 @@ +mutation { + accountCreatePhoneToken( + userId: "<USER_ID>", + phone: "+12065550100" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-graphql/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..a4cad59b1a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-phone-verification.md @@ -0,0 +1,10 @@ +mutation { + accountCreatePhoneVerification { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-recovery.md b/docs/examples/1.7.x/server-graphql/examples/account/create-recovery.md new file mode 100644 index 0000000000..ad31fd82d7 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-recovery.md @@ -0,0 +1,13 @@ +mutation { + accountCreateRecovery( + email: "email@example.com", + url: "https://example.com" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-session.md b/docs/examples/1.7.x/server-graphql/examples/account/create-session.md new file mode 100644 index 0000000000..f473d14207 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-session.md @@ -0,0 +1,36 @@ +mutation { + accountCreateSession( + userId: "<USER_ID>", + secret: "<SECRET>" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create-verification.md b/docs/examples/1.7.x/server-graphql/examples/account/create-verification.md new file mode 100644 index 0000000000..df50dda529 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create-verification.md @@ -0,0 +1,12 @@ +mutation { + accountCreateVerification( + url: "https://example.com" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/create.md b/docs/examples/1.7.x/server-graphql/examples/account/create.md new file mode 100644 index 0000000000..0d39394a3d --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/create.md @@ -0,0 +1,40 @@ +mutation { + accountCreate( + userId: "<USER_ID>", + email: "email@example.com", + password: "", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/delete-identity.md b/docs/examples/1.7.x/server-graphql/examples/account/delete-identity.md new file mode 100644 index 0000000000..f3c2e2e7b9 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/delete-identity.md @@ -0,0 +1,7 @@ +mutation { + accountDeleteIdentity( + identityId: "<IDENTITY_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-graphql/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..fc5486623a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,7 @@ +mutation { + accountDeleteMfaAuthenticator( + type: "totp" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/delete-session.md b/docs/examples/1.7.x/server-graphql/examples/account/delete-session.md new file mode 100644 index 0000000000..09aff38fdd --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/delete-session.md @@ -0,0 +1,7 @@ +mutation { + accountDeleteSession( + sessionId: "<SESSION_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-graphql/examples/account/delete-sessions.md new file mode 100644 index 0000000000..b0d61daa81 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/delete-sessions.md @@ -0,0 +1,5 @@ +mutation { + accountDeleteSessions { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-graphql/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/account/get-prefs.md b/docs/examples/1.7.x/server-graphql/examples/account/get-prefs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/account/get-session.md b/docs/examples/1.7.x/server-graphql/examples/account/get-session.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/account/get.md b/docs/examples/1.7.x/server-graphql/examples/account/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/account/list-identities.md b/docs/examples/1.7.x/server-graphql/examples/account/list-identities.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/account/list-logs.md b/docs/examples/1.7.x/server-graphql/examples/account/list-logs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-graphql/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/account/list-sessions.md b/docs/examples/1.7.x/server-graphql/examples/account/list-sessions.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-email.md b/docs/examples/1.7.x/server-graphql/examples/account/update-email.md new file mode 100644 index 0000000000..c879e24a43 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-email.md @@ -0,0 +1,38 @@ +mutation { + accountUpdateEmail( + email: "email@example.com", + password: "password" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-graphql/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..787c2e0860 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-m-f-a.md @@ -0,0 +1,37 @@ +mutation { + accountUpdateMFA( + mfa: false + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-graphql/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..075bc91d17 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,36 @@ +mutation { + accountUpdateMagicURLSession( + userId: "<USER_ID>", + secret: "<SECRET>" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-graphql/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..9cfe9150be --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-mfa-authenticator.md @@ -0,0 +1,38 @@ +mutation { + accountUpdateMfaAuthenticator( + type: "totp", + otp: "<OTP>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-graphql/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..0bcec2157f --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-mfa-challenge.md @@ -0,0 +1,36 @@ +mutation { + accountUpdateMfaChallenge( + challengeId: "<CHALLENGE_ID>", + otp: "<OTP>" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-graphql/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..e706d2b9d7 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,5 @@ +mutation { + accountUpdateMfaRecoveryCodes { + recoveryCodes + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-name.md b/docs/examples/1.7.x/server-graphql/examples/account/update-name.md new file mode 100644 index 0000000000..8ba2c99d9c --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-name.md @@ -0,0 +1,37 @@ +mutation { + accountUpdateName( + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-password.md b/docs/examples/1.7.x/server-graphql/examples/account/update-password.md new file mode 100644 index 0000000000..f3619a10d2 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-password.md @@ -0,0 +1,38 @@ +mutation { + accountUpdatePassword( + password: "", + oldPassword: "password" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-graphql/examples/account/update-phone-session.md new file mode 100644 index 0000000000..199e774ab0 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-phone-session.md @@ -0,0 +1,36 @@ +mutation { + accountUpdatePhoneSession( + userId: "<USER_ID>", + secret: "<SECRET>" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-graphql/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..dd62298bb9 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-phone-verification.md @@ -0,0 +1,13 @@ +mutation { + accountUpdatePhoneVerification( + userId: "<USER_ID>", + secret: "<SECRET>" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-phone.md b/docs/examples/1.7.x/server-graphql/examples/account/update-phone.md new file mode 100644 index 0000000000..adecb71168 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-phone.md @@ -0,0 +1,38 @@ +mutation { + accountUpdatePhone( + phone: "+12065550100", + password: "password" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-prefs.md b/docs/examples/1.7.x/server-graphql/examples/account/update-prefs.md new file mode 100644 index 0000000000..57280247e4 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-prefs.md @@ -0,0 +1,37 @@ +mutation { + accountUpdatePrefs( + prefs: "{}" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-recovery.md b/docs/examples/1.7.x/server-graphql/examples/account/update-recovery.md new file mode 100644 index 0000000000..2d15fdcaa1 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-recovery.md @@ -0,0 +1,14 @@ +mutation { + accountUpdateRecovery( + userId: "<USER_ID>", + secret: "<SECRET>", + password: "" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-session.md b/docs/examples/1.7.x/server-graphql/examples/account/update-session.md new file mode 100644 index 0000000000..29a8979872 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-session.md @@ -0,0 +1,35 @@ +mutation { + accountUpdateSession( + sessionId: "<SESSION_ID>" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-status.md b/docs/examples/1.7.x/server-graphql/examples/account/update-status.md new file mode 100644 index 0000000000..c17f556842 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-status.md @@ -0,0 +1,35 @@ +mutation { + accountUpdateStatus { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/account/update-verification.md b/docs/examples/1.7.x/server-graphql/examples/account/update-verification.md new file mode 100644 index 0000000000..11e63c7da3 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/account/update-verification.md @@ -0,0 +1,13 @@ +mutation { + accountUpdateVerification( + userId: "<USER_ID>", + secret: "<SECRET>" + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-graphql/examples/avatars/get-browser.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-graphql/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-graphql/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-graphql/examples/avatars/get-flag.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/avatars/get-image.md b/docs/examples/1.7.x/server-graphql/examples/avatars/get-image.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-graphql/examples/avatars/get-initials.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-graphql/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..aa0bfa832e --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-boolean-attribute.md @@ -0,0 +1,20 @@ +mutation { + databasesCreateBooleanAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: false, + array: false + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-collection.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-collection.md new file mode 100644 index 0000000000..00dfba1e7b --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-collection.md @@ -0,0 +1,31 @@ +mutation { + databasesCreateCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + name: "<NAME>", + permissions: ["read("any")"], + documentSecurity: false, + enabled: false + ) { + _id + _createdAt + _updatedAt + _permissions + databaseId + name + enabled + documentSecurity + attributes + indexes { + key + type + status + error + attributes + lengths + orders + _createdAt + _updatedAt + } + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..47601df0d8 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-datetime-attribute.md @@ -0,0 +1,21 @@ +mutation { + databasesCreateDatetimeAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", + array: false + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-document.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-document.md new file mode 100644 index 0000000000..4e2d90660b --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-document.md @@ -0,0 +1,17 @@ +mutation { + databasesCreateDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>", + data: "{}", + permissions: ["read("any")"] + ) { + _id + _collectionId + _databaseId + _createdAt + _updatedAt + _permissions + data + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-documents.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-documents.md new file mode 100644 index 0000000000..3e3a50f3ab --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-documents.md @@ -0,0 +1,18 @@ +mutation { + databasesCreateDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documents: [] + ) { + total + documents { + _id + _collectionId + _databaseId + _createdAt + _updatedAt + _permissions + data + } + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..e5845ccd47 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-email-attribute.md @@ -0,0 +1,21 @@ +mutation { + databasesCreateEmailAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "email@example.com", + array: false + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..d13c080e4a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-enum-attribute.md @@ -0,0 +1,23 @@ +mutation { + databasesCreateEnumAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + elements: [], + required: false, + default: "<DEFAULT>", + array: false + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + elements + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..2a270c3aff --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-float-attribute.md @@ -0,0 +1,24 @@ +mutation { + databasesCreateFloatAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + min: 0, + max: 0, + default: 0, + array: false + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + min + max + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-index.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-index.md new file mode 100644 index 0000000000..c647930943 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-index.md @@ -0,0 +1,21 @@ +mutation { + databasesCreateIndex( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + type: "key", + attributes: [], + orders: [], + lengths: [] + ) { + key + type + status + error + attributes + lengths + orders + _createdAt + _updatedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..8c79706817 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-integer-attribute.md @@ -0,0 +1,24 @@ +mutation { + databasesCreateIntegerAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + min: 0, + max: 0, + default: 0, + array: false + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + min + max + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..0f4ad9e139 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-ip-attribute.md @@ -0,0 +1,21 @@ +mutation { + databasesCreateIpAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", + array: false + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..f66b87d6af --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-relationship-attribute.md @@ -0,0 +1,27 @@ +mutation { + databasesCreateRelationshipAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + relatedCollectionId: "<RELATED_COLLECTION_ID>", + type: "oneToOne", + twoWay: false, + key: "", + twoWayKey: "", + onDelete: "cascade" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + relatedCollection + relationType + twoWay + twoWayKey + onDelete + side + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..62d97d6962 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-string-attribute.md @@ -0,0 +1,23 @@ +mutation { + databasesCreateStringAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + size: 1, + required: false, + default: "<DEFAULT>", + array: false, + encrypt: false + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + size + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..89ad873e52 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create-url-attribute.md @@ -0,0 +1,21 @@ +mutation { + databasesCreateUrlAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "https://example.com", + array: false + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/create.md b/docs/examples/1.7.x/server-graphql/examples/databases/create.md new file mode 100644 index 0000000000..c48e024e7c --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/create.md @@ -0,0 +1,13 @@ +mutation { + databasesCreate( + databaseId: "<DATABASE_ID>", + name: "<NAME>", + enabled: false + ) { + _id + name + _createdAt + _updatedAt + enabled + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..af0f9d6615 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/delete-attribute.md @@ -0,0 +1,9 @@ +mutation { + databasesDeleteAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-graphql/examples/databases/delete-collection.md new file mode 100644 index 0000000000..8683bd87a4 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/delete-collection.md @@ -0,0 +1,8 @@ +mutation { + databasesDeleteCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/delete-document.md b/docs/examples/1.7.x/server-graphql/examples/databases/delete-document.md new file mode 100644 index 0000000000..848371bca0 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/delete-document.md @@ -0,0 +1,9 @@ +mutation { + databasesDeleteDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-graphql/examples/databases/delete-documents.md new file mode 100644 index 0000000000..ad5826f22a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/delete-documents.md @@ -0,0 +1,18 @@ +mutation { + databasesDeleteDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + queries: [] + ) { + total + documents { + _id + _collectionId + _databaseId + _createdAt + _updatedAt + _permissions + data + } + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/delete-index.md b/docs/examples/1.7.x/server-graphql/examples/databases/delete-index.md new file mode 100644 index 0000000000..a2389cf9d4 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/delete-index.md @@ -0,0 +1,9 @@ +mutation { + databasesDeleteIndex( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/delete.md b/docs/examples/1.7.x/server-graphql/examples/databases/delete.md new file mode 100644 index 0000000000..7cd4c92341 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/delete.md @@ -0,0 +1,7 @@ +mutation { + databasesDelete( + databaseId: "<DATABASE_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/get-attribute.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/get-collection.md b/docs/examples/1.7.x/server-graphql/examples/databases/get-collection.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/get-document.md b/docs/examples/1.7.x/server-graphql/examples/databases/get-document.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/get-index.md b/docs/examples/1.7.x/server-graphql/examples/databases/get-index.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/get.md b/docs/examples/1.7.x/server-graphql/examples/databases/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-graphql/examples/databases/list-attributes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/list-collections.md b/docs/examples/1.7.x/server-graphql/examples/databases/list-collections.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/list-documents.md b/docs/examples/1.7.x/server-graphql/examples/databases/list-documents.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-graphql/examples/databases/list-indexes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/list.md b/docs/examples/1.7.x/server-graphql/examples/databases/list.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..d508e62139 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-boolean-attribute.md @@ -0,0 +1,20 @@ +mutation { + databasesUpdateBooleanAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: false, + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-collection.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-collection.md new file mode 100644 index 0000000000..040578ae9d --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-collection.md @@ -0,0 +1,31 @@ +mutation { + databasesUpdateCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + name: "<NAME>", + permissions: ["read("any")"], + documentSecurity: false, + enabled: false + ) { + _id + _createdAt + _updatedAt + _permissions + databaseId + name + enabled + documentSecurity + attributes + indexes { + key + type + status + error + attributes + lengths + orders + _createdAt + _updatedAt + } + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..a21b910edc --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-datetime-attribute.md @@ -0,0 +1,21 @@ +mutation { + databasesUpdateDatetimeAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-document.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-document.md new file mode 100644 index 0000000000..5e80894620 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-document.md @@ -0,0 +1,17 @@ +mutation { + databasesUpdateDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>", + data: "{}", + permissions: ["read("any")"] + ) { + _id + _collectionId + _databaseId + _createdAt + _updatedAt + _permissions + data + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-documents.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-documents.md new file mode 100644 index 0000000000..c05acb16a0 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-documents.md @@ -0,0 +1,19 @@ +mutation { + databasesUpdateDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + data: "{}", + queries: [] + ) { + total + documents { + _id + _collectionId + _databaseId + _createdAt + _updatedAt + _permissions + data + } + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..6c83d80e16 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-email-attribute.md @@ -0,0 +1,21 @@ +mutation { + databasesUpdateEmailAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "email@example.com", + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..378e32f9b8 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-enum-attribute.md @@ -0,0 +1,23 @@ +mutation { + databasesUpdateEnumAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + elements: [], + required: false, + default: "<DEFAULT>", + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + elements + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..c70232e749 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-float-attribute.md @@ -0,0 +1,24 @@ +mutation { + databasesUpdateFloatAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: 0, + min: 0, + max: 0, + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + min + max + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..b24af5f260 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-integer-attribute.md @@ -0,0 +1,24 @@ +mutation { + databasesUpdateIntegerAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: 0, + min: 0, + max: 0, + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + min + max + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..7a26224200 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-ip-attribute.md @@ -0,0 +1,21 @@ +mutation { + databasesUpdateIpAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..6694540d93 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-relationship-attribute.md @@ -0,0 +1,24 @@ +mutation { + databasesUpdateRelationshipAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + onDelete: "cascade", + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + relatedCollection + relationType + twoWay + twoWayKey + onDelete + side + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..afafb307f5 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-string-attribute.md @@ -0,0 +1,22 @@ +mutation { + databasesUpdateStringAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "<DEFAULT>", + size: 1, + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + size + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-graphql/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..f9f14a04f6 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update-url-attribute.md @@ -0,0 +1,21 @@ +mutation { + databasesUpdateUrlAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "https://example.com", + newKey: "" + ) { + key + type + status + error + required + array + _createdAt + _updatedAt + format + default + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/update.md b/docs/examples/1.7.x/server-graphql/examples/databases/update.md new file mode 100644 index 0000000000..88d286dc8a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/update.md @@ -0,0 +1,13 @@ +mutation { + databasesUpdate( + databaseId: "<DATABASE_ID>", + name: "<NAME>", + enabled: false + ) { + _id + name + _createdAt + _updatedAt + enabled + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-graphql/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..d6e7bba9a3 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/databases/upsert-documents.md @@ -0,0 +1,18 @@ +mutation { + databasesUpsertDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documents: [] + ) { + total + documents { + _id + _collectionId + _databaseId + _createdAt + _updatedAt + _permissions + data + } + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-graphql/examples/functions/create-deployment.md new file mode 100644 index 0000000000..0e7cc7d19a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/create-deployment.md @@ -0,0 +1,24 @@ +POST /v1/functions/{functionId}/deployments HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> +Content-Length: *Length of your entity body in bytes* + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="operations" + +{ "query": "mutation { functionsCreateDeployment(functionId: $functionId, code: $code, activate: $activate, entrypoint: $entrypoint, commands: $commands) { id }" }, "variables": { "functionId": "<FUNCTION_ID>", "code": null, "activate": false, "entrypoint": "<ENTRYPOINT>", "commands": "<COMMANDS>" } } + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="map" + +{ "0": ["variables.code"], } + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="0"; filename="code.ext" + +File contents + +--cec8e8123c05ba25-- diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-graphql/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..cdd92c2a02 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,35 @@ +mutation { + functionsCreateDuplicateDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>", + buildId: "<BUILD_ID>" + ) { + _id + _createdAt + _updatedAt + type + resourceId + resourceType + entrypoint + sourceSize + buildSize + totalSize + buildId + activate + screenshotLight + screenshotDark + status + buildLogs + buildDuration + providerRepositoryName + providerRepositoryOwner + providerRepositoryUrl + providerBranch + providerCommitHash + providerCommitAuthorUrl + providerCommitAuthor + providerCommitMessage + providerCommitUrl + providerBranchUrl + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/create-execution.md b/docs/examples/1.7.x/server-graphql/examples/functions/create-execution.md new file mode 100644 index 0000000000..1479aa3bb6 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/create-execution.md @@ -0,0 +1,35 @@ +mutation { + functionsCreateExecution( + functionId: "<FUNCTION_ID>", + body: "<BODY>", + async: false, + path: "<PATH>", + method: "GET", + headers: "{}", + scheduledAt: "" + ) { + _id + _createdAt + _updatedAt + _permissions + functionId + trigger + status + requestMethod + requestPath + requestHeaders { + name + value + } + responseStatusCode + responseBody + responseHeaders { + name + value + } + logs + errors + duration + scheduledAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-graphql/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..12c50c32f3 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/create-template-deployment.md @@ -0,0 +1,38 @@ +mutation { + functionsCreateTemplateDeployment( + functionId: "<FUNCTION_ID>", + repository: "<REPOSITORY>", + owner: "<OWNER>", + rootDirectory: "<ROOT_DIRECTORY>", + version: "<VERSION>", + activate: false + ) { + _id + _createdAt + _updatedAt + type + resourceId + resourceType + entrypoint + sourceSize + buildSize + totalSize + buildId + activate + screenshotLight + screenshotDark + status + buildLogs + buildDuration + providerRepositoryName + providerRepositoryOwner + providerRepositoryUrl + providerBranch + providerCommitHash + providerCommitAuthorUrl + providerCommitAuthor + providerCommitMessage + providerCommitUrl + providerBranchUrl + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/create-variable.md b/docs/examples/1.7.x/server-graphql/examples/functions/create-variable.md new file mode 100644 index 0000000000..6c64922320 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/create-variable.md @@ -0,0 +1,17 @@ +mutation { + functionsCreateVariable( + functionId: "<FUNCTION_ID>", + key: "<KEY>", + value: "<VALUE>", + secret: false + ) { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-graphql/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..ebfced2c68 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/create-vcs-deployment.md @@ -0,0 +1,36 @@ +mutation { + functionsCreateVcsDeployment( + functionId: "<FUNCTION_ID>", + type: "branch", + reference: "<REFERENCE>", + activate: false + ) { + _id + _createdAt + _updatedAt + type + resourceId + resourceType + entrypoint + sourceSize + buildSize + totalSize + buildId + activate + screenshotLight + screenshotDark + status + buildLogs + buildDuration + providerRepositoryName + providerRepositoryOwner + providerRepositoryUrl + providerBranch + providerCommitHash + providerCommitAuthorUrl + providerCommitAuthor + providerCommitMessage + providerCommitUrl + providerBranchUrl + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/create.md b/docs/examples/1.7.x/server-graphql/examples/functions/create.md new file mode 100644 index 0000000000..2df77be8ec --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/create.md @@ -0,0 +1,60 @@ +mutation { + functionsCreate( + functionId: "<FUNCTION_ID>", + name: "<NAME>", + runtime: "node-14.5", + execute: ["any"], + events: [], + schedule: "", + timeout: 1, + enabled: false, + logging: false, + entrypoint: "<ENTRYPOINT>", + commands: "<COMMANDS>", + scopes: [], + installationId: "<INSTALLATION_ID>", + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", + providerBranch: "<PROVIDER_BRANCH>", + providerSilentMode: false, + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", + specification: "" + ) { + _id + _createdAt + _updatedAt + execute + name + enabled + live + logging + runtime + deploymentId + deploymentCreatedAt + latestDeploymentId + latestDeploymentCreatedAt + latestDeploymentStatus + scopes + vars { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } + events + schedule + timeout + entrypoint + commands + version + installationId + providerRepositoryId + providerBranch + providerRootDirectory + providerSilentMode + specification + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-graphql/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..8d83f28d4f --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/delete-deployment.md @@ -0,0 +1,8 @@ +mutation { + functionsDeleteDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-graphql/examples/functions/delete-execution.md new file mode 100644 index 0000000000..c6e950afc9 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/delete-execution.md @@ -0,0 +1,8 @@ +mutation { + functionsDeleteExecution( + functionId: "<FUNCTION_ID>", + executionId: "<EXECUTION_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-graphql/examples/functions/delete-variable.md new file mode 100644 index 0000000000..9bc2d9b6e6 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/delete-variable.md @@ -0,0 +1,8 @@ +mutation { + functionsDeleteVariable( + functionId: "<FUNCTION_ID>", + variableId: "<VARIABLE_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/delete.md b/docs/examples/1.7.x/server-graphql/examples/functions/delete.md new file mode 100644 index 0000000000..db019bf376 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/delete.md @@ -0,0 +1,7 @@ +mutation { + functionsDelete( + functionId: "<FUNCTION_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-graphql/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-graphql/examples/functions/get-deployment.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/get-execution.md b/docs/examples/1.7.x/server-graphql/examples/functions/get-execution.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/get-variable.md b/docs/examples/1.7.x/server-graphql/examples/functions/get-variable.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/get.md b/docs/examples/1.7.x/server-graphql/examples/functions/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-graphql/examples/functions/list-deployments.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/list-executions.md b/docs/examples/1.7.x/server-graphql/examples/functions/list-executions.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-graphql/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-graphql/examples/functions/list-specifications.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/list-variables.md b/docs/examples/1.7.x/server-graphql/examples/functions/list-variables.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/list.md b/docs/examples/1.7.x/server-graphql/examples/functions/list.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-graphql/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..50df97fd21 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/update-deployment-status.md @@ -0,0 +1,34 @@ +mutation { + functionsUpdateDeploymentStatus( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" + ) { + _id + _createdAt + _updatedAt + type + resourceId + resourceType + entrypoint + sourceSize + buildSize + totalSize + buildId + activate + screenshotLight + screenshotDark + status + buildLogs + buildDuration + providerRepositoryName + providerRepositoryOwner + providerRepositoryUrl + providerBranch + providerCommitHash + providerCommitAuthorUrl + providerCommitAuthor + providerCommitMessage + providerCommitUrl + providerBranchUrl + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-graphql/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..3ff2220fda --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/update-function-deployment.md @@ -0,0 +1,44 @@ +mutation { + functionsUpdateFunctionDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" + ) { + _id + _createdAt + _updatedAt + execute + name + enabled + live + logging + runtime + deploymentId + deploymentCreatedAt + latestDeploymentId + latestDeploymentCreatedAt + latestDeploymentStatus + scopes + vars { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } + events + schedule + timeout + entrypoint + commands + version + installationId + providerRepositoryId + providerBranch + providerRootDirectory + providerSilentMode + specification + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/update-variable.md b/docs/examples/1.7.x/server-graphql/examples/functions/update-variable.md new file mode 100644 index 0000000000..15c8e3bdf3 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/update-variable.md @@ -0,0 +1,18 @@ +mutation { + functionsUpdateVariable( + functionId: "<FUNCTION_ID>", + variableId: "<VARIABLE_ID>", + key: "<KEY>", + value: "<VALUE>", + secret: false + ) { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/functions/update.md b/docs/examples/1.7.x/server-graphql/examples/functions/update.md new file mode 100644 index 0000000000..7510cdc50d --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/functions/update.md @@ -0,0 +1,60 @@ +mutation { + functionsUpdate( + functionId: "<FUNCTION_ID>", + name: "<NAME>", + runtime: "node-14.5", + execute: ["any"], + events: [], + schedule: "", + timeout: 1, + enabled: false, + logging: false, + entrypoint: "<ENTRYPOINT>", + commands: "<COMMANDS>", + scopes: [], + installationId: "<INSTALLATION_ID>", + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", + providerBranch: "<PROVIDER_BRANCH>", + providerSilentMode: false, + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", + specification: "" + ) { + _id + _createdAt + _updatedAt + execute + name + enabled + live + logging + runtime + deploymentId + deploymentCreatedAt + latestDeploymentId + latestDeploymentCreatedAt + latestDeploymentStatus + scopes + vars { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } + events + schedule + timeout + entrypoint + commands + version + installationId + providerRepositoryId + providerBranch + providerRootDirectory + providerSilentMode + specification + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-graphql/examples/health/get-antivirus.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-cache.md b/docs/examples/1.7.x/server-graphql/examples/health/get-cache.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-certificate.md b/docs/examples/1.7.x/server-graphql/examples/health/get-certificate.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-d-b.md b/docs/examples/1.7.x/server-graphql/examples/health/get-d-b.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-graphql/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-graphql/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-graphql/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-graphql/examples/health/get-storage-local.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-storage.md b/docs/examples/1.7.x/server-graphql/examples/health/get-storage.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get-time.md b/docs/examples/1.7.x/server-graphql/examples/health/get-time.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/health/get.md b/docs/examples/1.7.x/server-graphql/examples/health/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/locale/get.md b/docs/examples/1.7.x/server-graphql/examples/locale/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/locale/list-codes.md b/docs/examples/1.7.x/server-graphql/examples/locale/list-codes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/locale/list-continents.md b/docs/examples/1.7.x/server-graphql/examples/locale/list-continents.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-graphql/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-graphql/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/locale/list-countries.md b/docs/examples/1.7.x/server-graphql/examples/locale/list-countries.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-graphql/examples/locale/list-currencies.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/locale/list-languages.md b/docs/examples/1.7.x/server-graphql/examples/locale/list-languages.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..425b3bb8dc --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-apns-provider.md @@ -0,0 +1,22 @@ +mutation { + messagingCreateApnsProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + authKey: "<AUTH_KEY>", + authKeyId: "<AUTH_KEY_ID>", + teamId: "<TEAM_ID>", + bundleId: "<BUNDLE_ID>", + sandbox: false, + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-email.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-email.md new file mode 100644 index 0000000000..a1e35aad19 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-email.md @@ -0,0 +1,30 @@ +mutation { + messagingCreateEmail( + messageId: "<MESSAGE_ID>", + subject: "<SUBJECT>", + content: "<CONTENT>", + topics: [], + users: [], + targets: [], + cc: [], + bcc: [], + attachments: [], + draft: false, + html: false, + scheduledAt: "" + ) { + _id + _createdAt + _updatedAt + providerType + topics + users + targets + scheduledAt + deliveredAt + deliveryErrors + deliveredTotal + data + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..0aa48a9e2f --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-fcm-provider.md @@ -0,0 +1,18 @@ +mutation { + messagingCreateFcmProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + serviceAccountJSON: "{}", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..9da1e23847 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,24 @@ +mutation { + messagingCreateMailgunProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + apiKey: "<API_KEY>", + domain: "<DOMAIN>", + isEuRegion: false, + fromName: "<FROM_NAME>", + fromEmail: "email@example.com", + replyToName: "<REPLY_TO_NAME>", + replyToEmail: "email@example.com", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..ddaf2d4c2b --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-msg91provider.md @@ -0,0 +1,20 @@ +mutation { + messagingCreateMsg91Provider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + templateId: "<TEMPLATE_ID>", + senderId: "<SENDER_ID>", + authKey: "<AUTH_KEY>", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-push.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-push.md new file mode 100644 index 0000000000..92264d1b67 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-push.md @@ -0,0 +1,37 @@ +mutation { + messagingCreatePush( + messageId: "<MESSAGE_ID>", + title: "<TITLE>", + body: "<BODY>", + topics: [], + users: [], + targets: [], + data: "{}", + action: "<ACTION>", + image: "[ID1:ID2]", + icon: "<ICON>", + sound: "<SOUND>", + color: "<COLOR>", + tag: "<TAG>", + badge: 0, + draft: false, + scheduledAt: "", + contentAvailable: false, + critical: false, + priority: "normal" + ) { + _id + _createdAt + _updatedAt + providerType + topics + users + targets + scheduledAt + deliveredAt + deliveryErrors + deliveredTotal + data + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..cda0652d67 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,22 @@ +mutation { + messagingCreateSendgridProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + apiKey: "<API_KEY>", + fromName: "<FROM_NAME>", + fromEmail: "email@example.com", + replyToName: "<REPLY_TO_NAME>", + replyToEmail: "email@example.com", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-sms.md new file mode 100644 index 0000000000..99af83b154 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-sms.md @@ -0,0 +1,25 @@ +mutation { + messagingCreateSms( + messageId: "<MESSAGE_ID>", + content: "<CONTENT>", + topics: [], + users: [], + targets: [], + draft: false, + scheduledAt: "" + ) { + _id + _createdAt + _updatedAt + providerType + topics + users + targets + scheduledAt + deliveredAt + deliveryErrors + deliveredTotal + data + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..b7b24bc1a5 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-smtp-provider.md @@ -0,0 +1,28 @@ +mutation { + messagingCreateSmtpProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + host: "<HOST>", + port: 1, + username: "<USERNAME>", + password: "<PASSWORD>", + encryption: "none", + autoTLS: false, + mailer: "<MAILER>", + fromName: "<FROM_NAME>", + fromEmail: "email@example.com", + replyToName: "<REPLY_TO_NAME>", + replyToEmail: "email@example.com", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..bab53612b7 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-subscriber.md @@ -0,0 +1,27 @@ +mutation { + messagingCreateSubscriber( + topicId: "<TOPIC_ID>", + subscriberId: "<SUBSCRIBER_ID>", + targetId: "<TARGET_ID>" + ) { + _id + _createdAt + _updatedAt + targetId + target { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + userId + userName + topicId + providerType + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..7960a8427f --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-telesign-provider.md @@ -0,0 +1,20 @@ +mutation { + messagingCreateTelesignProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", + customerId: "<CUSTOMER_ID>", + apiKey: "<API_KEY>", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..e082097b70 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,20 @@ +mutation { + messagingCreateTextmagicProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", + username: "<USERNAME>", + apiKey: "<API_KEY>", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-topic.md new file mode 100644 index 0000000000..6216c4cda5 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-topic.md @@ -0,0 +1,16 @@ +mutation { + messagingCreateTopic( + topicId: "<TOPIC_ID>", + name: "<NAME>", + subscribe: ["any"] + ) { + _id + _createdAt + _updatedAt + name + emailTotal + smsTotal + pushTotal + subscribe + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..ac14d1d32b --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-twilio-provider.md @@ -0,0 +1,20 @@ +mutation { + messagingCreateTwilioProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", + accountSid: "<ACCOUNT_SID>", + authToken: "<AUTH_TOKEN>", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..ca7a710896 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/create-vonage-provider.md @@ -0,0 +1,20 @@ +mutation { + messagingCreateVonageProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", + apiKey: "<API_KEY>", + apiSecret: "<API_SECRET>", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..8d9ac35953 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/delete-provider.md @@ -0,0 +1,7 @@ +mutation { + messagingDeleteProvider( + providerId: "<PROVIDER_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-graphql/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..ededffcaac --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/delete-subscriber.md @@ -0,0 +1,8 @@ +mutation { + messagingDeleteSubscriber( + topicId: "<TOPIC_ID>", + subscriberId: "<SUBSCRIBER_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-graphql/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..e49cd1ed91 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/delete-topic.md @@ -0,0 +1,7 @@ +mutation { + messagingDeleteTopic( + topicId: "<TOPIC_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/delete.md b/docs/examples/1.7.x/server-graphql/examples/messaging/delete.md new file mode 100644 index 0000000000..495557ef18 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/delete.md @@ -0,0 +1,7 @@ +mutation { + messagingDelete( + messageId: "<MESSAGE_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/get-message.md b/docs/examples/1.7.x/server-graphql/examples/messaging/get-message.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/get-provider.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-graphql/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-graphql/examples/messaging/get-topic.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-graphql/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-graphql/examples/messaging/list-messages.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-graphql/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-graphql/examples/messaging/list-providers.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-graphql/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-graphql/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-graphql/examples/messaging/list-targets.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-graphql/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-graphql/examples/messaging/list-topics.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..b3d6e8745e --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-apns-provider.md @@ -0,0 +1,22 @@ +mutation { + messagingUpdateApnsProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + enabled: false, + authKey: "<AUTH_KEY>", + authKeyId: "<AUTH_KEY_ID>", + teamId: "<TEAM_ID>", + bundleId: "<BUNDLE_ID>", + sandbox: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-email.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-email.md new file mode 100644 index 0000000000..1d1302efc4 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-email.md @@ -0,0 +1,30 @@ +mutation { + messagingUpdateEmail( + messageId: "<MESSAGE_ID>", + topics: [], + users: [], + targets: [], + subject: "<SUBJECT>", + content: "<CONTENT>", + draft: false, + html: false, + cc: [], + bcc: [], + scheduledAt: "", + attachments: [] + ) { + _id + _createdAt + _updatedAt + providerType + topics + users + targets + scheduledAt + deliveredAt + deliveryErrors + deliveredTotal + data + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..a0b3f9e3da --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-fcm-provider.md @@ -0,0 +1,18 @@ +mutation { + messagingUpdateFcmProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + enabled: false, + serviceAccountJSON: "{}" + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..6c26d52ff2 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,24 @@ +mutation { + messagingUpdateMailgunProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + apiKey: "<API_KEY>", + domain: "<DOMAIN>", + isEuRegion: false, + enabled: false, + fromName: "<FROM_NAME>", + fromEmail: "email@example.com", + replyToName: "<REPLY_TO_NAME>", + replyToEmail: "<REPLY_TO_EMAIL>" + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..a6552a4734 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-msg91provider.md @@ -0,0 +1,20 @@ +mutation { + messagingUpdateMsg91Provider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + enabled: false, + templateId: "<TEMPLATE_ID>", + senderId: "<SENDER_ID>", + authKey: "<AUTH_KEY>" + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-push.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-push.md new file mode 100644 index 0000000000..8ee2f57610 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-push.md @@ -0,0 +1,37 @@ +mutation { + messagingUpdatePush( + messageId: "<MESSAGE_ID>", + topics: [], + users: [], + targets: [], + title: "<TITLE>", + body: "<BODY>", + data: "{}", + action: "<ACTION>", + image: "[ID1:ID2]", + icon: "<ICON>", + sound: "<SOUND>", + color: "<COLOR>", + tag: "<TAG>", + badge: 0, + draft: false, + scheduledAt: "", + contentAvailable: false, + critical: false, + priority: "normal" + ) { + _id + _createdAt + _updatedAt + providerType + topics + users + targets + scheduledAt + deliveredAt + deliveryErrors + deliveredTotal + data + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..319dcea461 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,22 @@ +mutation { + messagingUpdateSendgridProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + enabled: false, + apiKey: "<API_KEY>", + fromName: "<FROM_NAME>", + fromEmail: "email@example.com", + replyToName: "<REPLY_TO_NAME>", + replyToEmail: "<REPLY_TO_EMAIL>" + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-sms.md new file mode 100644 index 0000000000..7b45f09abc --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-sms.md @@ -0,0 +1,25 @@ +mutation { + messagingUpdateSms( + messageId: "<MESSAGE_ID>", + topics: [], + users: [], + targets: [], + content: "<CONTENT>", + draft: false, + scheduledAt: "" + ) { + _id + _createdAt + _updatedAt + providerType + topics + users + targets + scheduledAt + deliveredAt + deliveryErrors + deliveredTotal + data + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..a091685655 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-smtp-provider.md @@ -0,0 +1,28 @@ +mutation { + messagingUpdateSmtpProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + host: "<HOST>", + port: 1, + username: "<USERNAME>", + password: "<PASSWORD>", + encryption: "none", + autoTLS: false, + mailer: "<MAILER>", + fromName: "<FROM_NAME>", + fromEmail: "email@example.com", + replyToName: "<REPLY_TO_NAME>", + replyToEmail: "<REPLY_TO_EMAIL>", + enabled: false + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..c9c96c0d5d --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-telesign-provider.md @@ -0,0 +1,20 @@ +mutation { + messagingUpdateTelesignProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + enabled: false, + customerId: "<CUSTOMER_ID>", + apiKey: "<API_KEY>", + from: "<FROM>" + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..3fd68ed8e9 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,20 @@ +mutation { + messagingUpdateTextmagicProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + enabled: false, + username: "<USERNAME>", + apiKey: "<API_KEY>", + from: "<FROM>" + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-topic.md new file mode 100644 index 0000000000..8d3dc84c72 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-topic.md @@ -0,0 +1,16 @@ +mutation { + messagingUpdateTopic( + topicId: "<TOPIC_ID>", + name: "<NAME>", + subscribe: ["any"] + ) { + _id + _createdAt + _updatedAt + name + emailTotal + smsTotal + pushTotal + subscribe + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..6f10839567 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-twilio-provider.md @@ -0,0 +1,20 @@ +mutation { + messagingUpdateTwilioProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + enabled: false, + accountSid: "<ACCOUNT_SID>", + authToken: "<AUTH_TOKEN>", + from: "<FROM>" + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-graphql/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..f42670a428 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/messaging/update-vonage-provider.md @@ -0,0 +1,20 @@ +mutation { + messagingUpdateVonageProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + enabled: false, + apiKey: "<API_KEY>", + apiSecret: "<API_SECRET>", + from: "<FROM>" + ) { + _id + _createdAt + _updatedAt + name + provider + enabled + type + credentials + options + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-graphql/examples/sites/create-deployment.md new file mode 100644 index 0000000000..8f77dd60eb --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/create-deployment.md @@ -0,0 +1,24 @@ +POST /v1/sites/{siteId}/deployments HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> +Content-Length: *Length of your entity body in bytes* + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="operations" + +{ "query": "mutation { sitesCreateDeployment(siteId: $siteId, code: $code, activate: $activate, installCommand: $installCommand, buildCommand: $buildCommand, outputDirectory: $outputDirectory) { id }" }, "variables": { "siteId": "<SITE_ID>", "code": null, "activate": false, "installCommand": "<INSTALL_COMMAND>", "buildCommand": "<BUILD_COMMAND>", "outputDirectory": "<OUTPUT_DIRECTORY>" } } + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="map" + +{ "0": ["variables.code"], } + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="0"; filename="code.ext" + +File contents + +--cec8e8123c05ba25-- diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-graphql/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..6226282651 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,34 @@ +mutation { + sitesCreateDuplicateDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" + ) { + _id + _createdAt + _updatedAt + type + resourceId + resourceType + entrypoint + sourceSize + buildSize + totalSize + buildId + activate + screenshotLight + screenshotDark + status + buildLogs + buildDuration + providerRepositoryName + providerRepositoryOwner + providerRepositoryUrl + providerBranch + providerCommitHash + providerCommitAuthorUrl + providerCommitAuthor + providerCommitMessage + providerCommitUrl + providerBranchUrl + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-graphql/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..72562556e4 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/create-template-deployment.md @@ -0,0 +1,38 @@ +mutation { + sitesCreateTemplateDeployment( + siteId: "<SITE_ID>", + repository: "<REPOSITORY>", + owner: "<OWNER>", + rootDirectory: "<ROOT_DIRECTORY>", + version: "<VERSION>", + activate: false + ) { + _id + _createdAt + _updatedAt + type + resourceId + resourceType + entrypoint + sourceSize + buildSize + totalSize + buildId + activate + screenshotLight + screenshotDark + status + buildLogs + buildDuration + providerRepositoryName + providerRepositoryOwner + providerRepositoryUrl + providerBranch + providerCommitHash + providerCommitAuthorUrl + providerCommitAuthor + providerCommitMessage + providerCommitUrl + providerBranchUrl + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/create-variable.md b/docs/examples/1.7.x/server-graphql/examples/sites/create-variable.md new file mode 100644 index 0000000000..6bc92de43a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/create-variable.md @@ -0,0 +1,17 @@ +mutation { + sitesCreateVariable( + siteId: "<SITE_ID>", + key: "<KEY>", + value: "<VALUE>", + secret: false + ) { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-graphql/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..ccc18cf2e0 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/create-vcs-deployment.md @@ -0,0 +1,36 @@ +mutation { + sitesCreateVcsDeployment( + siteId: "<SITE_ID>", + type: "branch", + reference: "<REFERENCE>", + activate: false + ) { + _id + _createdAt + _updatedAt + type + resourceId + resourceType + entrypoint + sourceSize + buildSize + totalSize + buildId + activate + screenshotLight + screenshotDark + status + buildLogs + buildDuration + providerRepositoryName + providerRepositoryOwner + providerRepositoryUrl + providerBranch + providerCommitHash + providerCommitAuthorUrl + providerCommitAuthor + providerCommitMessage + providerCommitUrl + providerBranchUrl + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/create.md b/docs/examples/1.7.x/server-graphql/examples/sites/create.md new file mode 100644 index 0000000000..bb89ac9344 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/create.md @@ -0,0 +1,61 @@ +mutation { + sitesCreate( + siteId: "<SITE_ID>", + name: "<NAME>", + framework: "analog", + buildRuntime: "node-14.5", + enabled: false, + logging: false, + timeout: 1, + installCommand: "<INSTALL_COMMAND>", + buildCommand: "<BUILD_COMMAND>", + outputDirectory: "<OUTPUT_DIRECTORY>", + adapter: "static", + installationId: "<INSTALLATION_ID>", + fallbackFile: "<FALLBACK_FILE>", + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", + providerBranch: "<PROVIDER_BRANCH>", + providerSilentMode: false, + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", + specification: "" + ) { + _id + _createdAt + _updatedAt + name + enabled + live + logging + framework + deploymentId + deploymentCreatedAt + deploymentScreenshotLight + deploymentScreenshotDark + latestDeploymentId + latestDeploymentCreatedAt + latestDeploymentStatus + vars { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } + timeout + installCommand + buildCommand + outputDirectory + installationId + providerRepositoryId + providerBranch + providerRootDirectory + providerSilentMode + specification + buildRuntime + adapter + fallbackFile + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-graphql/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..443a951cee --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/delete-deployment.md @@ -0,0 +1,8 @@ +mutation { + sitesDeleteDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/delete-log.md b/docs/examples/1.7.x/server-graphql/examples/sites/delete-log.md new file mode 100644 index 0000000000..60f27218c0 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/delete-log.md @@ -0,0 +1,8 @@ +mutation { + sitesDeleteLog( + siteId: "<SITE_ID>", + logId: "<LOG_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-graphql/examples/sites/delete-variable.md new file mode 100644 index 0000000000..2f86eddff1 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/delete-variable.md @@ -0,0 +1,8 @@ +mutation { + sitesDeleteVariable( + siteId: "<SITE_ID>", + variableId: "<VARIABLE_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/delete.md b/docs/examples/1.7.x/server-graphql/examples/sites/delete.md new file mode 100644 index 0000000000..35138f6d4f --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/delete.md @@ -0,0 +1,7 @@ +mutation { + sitesDelete( + siteId: "<SITE_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-graphql/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-graphql/examples/sites/get-deployment.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/get-log.md b/docs/examples/1.7.x/server-graphql/examples/sites/get-log.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/get-variable.md b/docs/examples/1.7.x/server-graphql/examples/sites/get-variable.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/get.md b/docs/examples/1.7.x/server-graphql/examples/sites/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-graphql/examples/sites/list-deployments.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-graphql/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/list-logs.md b/docs/examples/1.7.x/server-graphql/examples/sites/list-logs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-graphql/examples/sites/list-specifications.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/list-variables.md b/docs/examples/1.7.x/server-graphql/examples/sites/list-variables.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/list.md b/docs/examples/1.7.x/server-graphql/examples/sites/list.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-graphql/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..92751c167f --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/update-deployment-status.md @@ -0,0 +1,34 @@ +mutation { + sitesUpdateDeploymentStatus( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" + ) { + _id + _createdAt + _updatedAt + type + resourceId + resourceType + entrypoint + sourceSize + buildSize + totalSize + buildId + activate + screenshotLight + screenshotDark + status + buildLogs + buildDuration + providerRepositoryName + providerRepositoryOwner + providerRepositoryUrl + providerBranch + providerCommitHash + providerCommitAuthorUrl + providerCommitAuthor + providerCommitMessage + providerCommitUrl + providerBranchUrl + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-graphql/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..6c09c03735 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/update-site-deployment.md @@ -0,0 +1,45 @@ +mutation { + sitesUpdateSiteDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" + ) { + _id + _createdAt + _updatedAt + name + enabled + live + logging + framework + deploymentId + deploymentCreatedAt + deploymentScreenshotLight + deploymentScreenshotDark + latestDeploymentId + latestDeploymentCreatedAt + latestDeploymentStatus + vars { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } + timeout + installCommand + buildCommand + outputDirectory + installationId + providerRepositoryId + providerBranch + providerRootDirectory + providerSilentMode + specification + buildRuntime + adapter + fallbackFile + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/update-variable.md b/docs/examples/1.7.x/server-graphql/examples/sites/update-variable.md new file mode 100644 index 0000000000..240dca60f3 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/update-variable.md @@ -0,0 +1,18 @@ +mutation { + sitesUpdateVariable( + siteId: "<SITE_ID>", + variableId: "<VARIABLE_ID>", + key: "<KEY>", + value: "<VALUE>", + secret: false + ) { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/sites/update.md b/docs/examples/1.7.x/server-graphql/examples/sites/update.md new file mode 100644 index 0000000000..801eca3161 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/sites/update.md @@ -0,0 +1,61 @@ +mutation { + sitesUpdate( + siteId: "<SITE_ID>", + name: "<NAME>", + framework: "analog", + enabled: false, + logging: false, + timeout: 1, + installCommand: "<INSTALL_COMMAND>", + buildCommand: "<BUILD_COMMAND>", + outputDirectory: "<OUTPUT_DIRECTORY>", + buildRuntime: "node-14.5", + adapter: "static", + fallbackFile: "<FALLBACK_FILE>", + installationId: "<INSTALLATION_ID>", + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", + providerBranch: "<PROVIDER_BRANCH>", + providerSilentMode: false, + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", + specification: "" + ) { + _id + _createdAt + _updatedAt + name + enabled + live + logging + framework + deploymentId + deploymentCreatedAt + deploymentScreenshotLight + deploymentScreenshotDark + latestDeploymentId + latestDeploymentCreatedAt + latestDeploymentStatus + vars { + _id + _createdAt + _updatedAt + key + value + secret + resourceType + resourceId + } + timeout + installCommand + buildCommand + outputDirectory + installationId + providerRepositoryId + providerBranch + providerRootDirectory + providerSilentMode + specification + buildRuntime + adapter + fallbackFile + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-graphql/examples/storage/create-bucket.md new file mode 100644 index 0000000000..45d03802d2 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/storage/create-bucket.md @@ -0,0 +1,27 @@ +mutation { + storageCreateBucket( + bucketId: "<BUCKET_ID>", + name: "<NAME>", + permissions: ["read("any")"], + fileSecurity: false, + enabled: false, + maximumFileSize: 1, + allowedFileExtensions: [], + compression: "none", + encryption: false, + antivirus: false + ) { + _id + _createdAt + _updatedAt + _permissions + fileSecurity + name + enabled + maximumFileSize + allowedFileExtensions + compression + encryption + antivirus + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/create-file.md b/docs/examples/1.7.x/server-graphql/examples/storage/create-file.md new file mode 100644 index 0000000000..5b4f9a0c22 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/storage/create-file.md @@ -0,0 +1,26 @@ +POST /v1/storage/buckets/{bucketId}/files HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> +Content-Length: *Length of your entity body in bytes* + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="operations" + +{ "query": "mutation { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: $file, permissions: $permissions) { id }" }, "variables": { "bucketId": "<BUCKET_ID>", "fileId": "<FILE_ID>", "file": null, "permissions": ["read("any")"] } } + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="map" + +{ "0": ["variables.file"], } + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="0"; filename="file.ext" + +File contents + +--cec8e8123c05ba25-- diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-graphql/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..3dadd1f072 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/storage/delete-bucket.md @@ -0,0 +1,7 @@ +mutation { + storageDeleteBucket( + bucketId: "<BUCKET_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/delete-file.md b/docs/examples/1.7.x/server-graphql/examples/storage/delete-file.md new file mode 100644 index 0000000000..17ec89931a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/storage/delete-file.md @@ -0,0 +1,8 @@ +mutation { + storageDeleteFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-graphql/examples/storage/get-bucket.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-graphql/examples/storage/get-file-download.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-graphql/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-graphql/examples/storage/get-file-view.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/get-file.md b/docs/examples/1.7.x/server-graphql/examples/storage/get-file.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-graphql/examples/storage/list-buckets.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/list-files.md b/docs/examples/1.7.x/server-graphql/examples/storage/list-files.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-graphql/examples/storage/update-bucket.md new file mode 100644 index 0000000000..8265a15a58 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/storage/update-bucket.md @@ -0,0 +1,27 @@ +mutation { + storageUpdateBucket( + bucketId: "<BUCKET_ID>", + name: "<NAME>", + permissions: ["read("any")"], + fileSecurity: false, + enabled: false, + maximumFileSize: 1, + allowedFileExtensions: [], + compression: "none", + encryption: false, + antivirus: false + ) { + _id + _createdAt + _updatedAt + _permissions + fileSecurity + name + enabled + maximumFileSize + allowedFileExtensions + compression + encryption + antivirus + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/storage/update-file.md b/docs/examples/1.7.x/server-graphql/examples/storage/update-file.md new file mode 100644 index 0000000000..b7832048c7 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/storage/update-file.md @@ -0,0 +1,20 @@ +mutation { + storageUpdateFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + name: "<NAME>", + permissions: ["read("any")"] + ) { + _id + bucketId + _createdAt + _updatedAt + _permissions + name + signature + mimeType + sizeOriginal + chunksTotal + chunksUploaded + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/create-membership.md b/docs/examples/1.7.x/server-graphql/examples/teams/create-membership.md new file mode 100644 index 0000000000..fe741f080d --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/teams/create-membership.md @@ -0,0 +1,25 @@ +mutation { + teamsCreateMembership( + teamId: "<TEAM_ID>", + roles: [], + email: "email@example.com", + userId: "<USER_ID>", + phone: "+12065550100", + url: "https://example.com", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + userId + userName + userEmail + teamId + teamName + invited + joined + confirm + mfa + roles + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/create.md b/docs/examples/1.7.x/server-graphql/examples/teams/create.md new file mode 100644 index 0000000000..1f2a7ab3f2 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/teams/create.md @@ -0,0 +1,16 @@ +mutation { + teamsCreate( + teamId: "<TEAM_ID>", + name: "<NAME>", + roles: [] + ) { + _id + _createdAt + _updatedAt + name + total + prefs { + data + } + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-graphql/examples/teams/delete-membership.md new file mode 100644 index 0000000000..e391b6f6fa --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/teams/delete-membership.md @@ -0,0 +1,8 @@ +mutation { + teamsDeleteMembership( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/delete.md b/docs/examples/1.7.x/server-graphql/examples/teams/delete.md new file mode 100644 index 0000000000..df0d36c5b5 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/teams/delete.md @@ -0,0 +1,7 @@ +mutation { + teamsDelete( + teamId: "<TEAM_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/get-membership.md b/docs/examples/1.7.x/server-graphql/examples/teams/get-membership.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-graphql/examples/teams/get-prefs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/get.md b/docs/examples/1.7.x/server-graphql/examples/teams/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-graphql/examples/teams/list-memberships.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/list.md b/docs/examples/1.7.x/server-graphql/examples/teams/list.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-graphql/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..9b24450a86 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/teams/update-membership-status.md @@ -0,0 +1,22 @@ +mutation { + teamsUpdateMembershipStatus( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>", + userId: "<USER_ID>", + secret: "<SECRET>" + ) { + _id + _createdAt + _updatedAt + userId + userName + userEmail + teamId + teamName + invited + joined + confirm + mfa + roles + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/update-membership.md b/docs/examples/1.7.x/server-graphql/examples/teams/update-membership.md new file mode 100644 index 0000000000..1c6a04f078 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/teams/update-membership.md @@ -0,0 +1,21 @@ +mutation { + teamsUpdateMembership( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>", + roles: [] + ) { + _id + _createdAt + _updatedAt + userId + userName + userEmail + teamId + teamName + invited + joined + confirm + mfa + roles + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/update-name.md b/docs/examples/1.7.x/server-graphql/examples/teams/update-name.md new file mode 100644 index 0000000000..c40543b5cd --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/teams/update-name.md @@ -0,0 +1,15 @@ +mutation { + teamsUpdateName( + teamId: "<TEAM_ID>", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + total + prefs { + data + } + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-graphql/examples/teams/update-prefs.md new file mode 100644 index 0000000000..95737e33f9 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/teams/update-prefs.md @@ -0,0 +1,8 @@ +mutation { + teamsUpdatePrefs( + teamId: "<TEAM_ID>", + prefs: "{}" + ) { + data + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-graphql/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..22cff062fa --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/tokens/create-file-token.md @@ -0,0 +1,15 @@ +mutation { + tokensCreateFileToken( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + expire: "" + ) { + _id + _createdAt + resourceId + resourceType + expire + secret + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/tokens/delete.md b/docs/examples/1.7.x/server-graphql/examples/tokens/delete.md new file mode 100644 index 0000000000..b13ad72f6b --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/tokens/delete.md @@ -0,0 +1,7 @@ +mutation { + tokensDelete( + tokenId: "<TOKEN_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/tokens/get.md b/docs/examples/1.7.x/server-graphql/examples/tokens/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/tokens/list.md b/docs/examples/1.7.x/server-graphql/examples/tokens/list.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/tokens/update.md b/docs/examples/1.7.x/server-graphql/examples/tokens/update.md new file mode 100644 index 0000000000..2f7324fd04 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/tokens/update.md @@ -0,0 +1,14 @@ +mutation { + tokensUpdate( + tokenId: "<TOKEN_ID>", + expire: "" + ) { + _id + _createdAt + resourceId + resourceType + expire + secret + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-graphql/examples/users/create-argon2user.md new file mode 100644 index 0000000000..7f99622e52 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-argon2user.md @@ -0,0 +1,40 @@ +mutation { + usersCreateArgon2User( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-graphql/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..26659176eb --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-bcrypt-user.md @@ -0,0 +1,40 @@ +mutation { + usersCreateBcryptUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-graphql/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..bf0b1bd638 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-j-w-t.md @@ -0,0 +1,9 @@ +mutation { + usersCreateJWT( + userId: "<USER_ID>", + sessionId: "<SESSION_ID>", + duration: 0 + ) { + jwt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-graphql/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..7e642b8233 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-m-d5user.md @@ -0,0 +1,40 @@ +mutation { + usersCreateMD5User( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-graphql/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..7c4f1c5575 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,7 @@ +mutation { + usersCreateMfaRecoveryCodes( + userId: "<USER_ID>" + ) { + recoveryCodes + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-graphql/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..4c06b007a2 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-p-h-pass-user.md @@ -0,0 +1,40 @@ +mutation { + usersCreatePHPassUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-graphql/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..f99da2752d --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-s-h-a-user.md @@ -0,0 +1,41 @@ +mutation { + usersCreateSHAUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + passwordVersion: "sha1", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-graphql/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..624ffcdd38 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,43 @@ +mutation { + usersCreateScryptModifiedUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + passwordSalt: "<PASSWORD_SALT>", + passwordSaltSeparator: "<PASSWORD_SALT_SEPARATOR>", + passwordSignerKey: "<PASSWORD_SIGNER_KEY>", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-graphql/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..68a5f4c75f --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-scrypt-user.md @@ -0,0 +1,45 @@ +mutation { + usersCreateScryptUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + passwordSalt: "<PASSWORD_SALT>", + passwordCpu: 0, + passwordMemory: 0, + passwordParallel: 0, + passwordLength: 0, + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-session.md b/docs/examples/1.7.x/server-graphql/examples/users/create-session.md new file mode 100644 index 0000000000..701ddf501f --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-session.md @@ -0,0 +1,35 @@ +mutation { + usersCreateSession( + userId: "<USER_ID>" + ) { + _id + _createdAt + _updatedAt + userId + expire + provider + providerUid + providerAccessToken + providerAccessTokenExpiry + providerRefreshToken + ip + osCode + osName + osVersion + clientType + clientCode + clientName + clientVersion + clientEngine + clientEngineVersion + deviceName + deviceBrand + deviceModel + countryCode + countryName + current + factors + secret + mfaUpdatedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-target.md b/docs/examples/1.7.x/server-graphql/examples/users/create-target.md new file mode 100644 index 0000000000..7068c21aba --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-target.md @@ -0,0 +1,20 @@ +mutation { + usersCreateTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>", + providerType: "email", + identifier: "<IDENTIFIER>", + providerId: "<PROVIDER_ID>", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create-token.md b/docs/examples/1.7.x/server-graphql/examples/users/create-token.md new file mode 100644 index 0000000000..78255f7676 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create-token.md @@ -0,0 +1,14 @@ +mutation { + usersCreateToken( + userId: "<USER_ID>", + length: 4, + expire: 60 + ) { + _id + _createdAt + userId + secret + expire + phrase + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/create.md b/docs/examples/1.7.x/server-graphql/examples/users/create.md new file mode 100644 index 0000000000..465da80432 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/create.md @@ -0,0 +1,41 @@ +mutation { + usersCreate( + userId: "<USER_ID>", + email: "email@example.com", + phone: "+12065550100", + password: "", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/delete-identity.md b/docs/examples/1.7.x/server-graphql/examples/users/delete-identity.md new file mode 100644 index 0000000000..1ea0d990b1 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/delete-identity.md @@ -0,0 +1,7 @@ +mutation { + usersDeleteIdentity( + identityId: "<IDENTITY_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-graphql/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..43f73404f0 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,8 @@ +mutation { + usersDeleteMfaAuthenticator( + userId: "<USER_ID>", + type: "totp" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/delete-session.md b/docs/examples/1.7.x/server-graphql/examples/users/delete-session.md new file mode 100644 index 0000000000..7e6538b34a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/delete-session.md @@ -0,0 +1,8 @@ +mutation { + usersDeleteSession( + userId: "<USER_ID>", + sessionId: "<SESSION_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-graphql/examples/users/delete-sessions.md new file mode 100644 index 0000000000..d1ccaa26f4 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/delete-sessions.md @@ -0,0 +1,7 @@ +mutation { + usersDeleteSessions( + userId: "<USER_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/delete-target.md b/docs/examples/1.7.x/server-graphql/examples/users/delete-target.md new file mode 100644 index 0000000000..92d0a16ac5 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/delete-target.md @@ -0,0 +1,8 @@ +mutation { + usersDeleteTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/delete.md b/docs/examples/1.7.x/server-graphql/examples/users/delete.md new file mode 100644 index 0000000000..2cf392b7f1 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/delete.md @@ -0,0 +1,7 @@ +mutation { + usersDelete( + userId: "<USER_ID>" + ) { + status + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-graphql/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/get-prefs.md b/docs/examples/1.7.x/server-graphql/examples/users/get-prefs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/get-target.md b/docs/examples/1.7.x/server-graphql/examples/users/get-target.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/get.md b/docs/examples/1.7.x/server-graphql/examples/users/get.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/list-identities.md b/docs/examples/1.7.x/server-graphql/examples/users/list-identities.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/list-logs.md b/docs/examples/1.7.x/server-graphql/examples/users/list-logs.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/list-memberships.md b/docs/examples/1.7.x/server-graphql/examples/users/list-memberships.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-graphql/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/list-sessions.md b/docs/examples/1.7.x/server-graphql/examples/users/list-sessions.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/list-targets.md b/docs/examples/1.7.x/server-graphql/examples/users/list-targets.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/list.md b/docs/examples/1.7.x/server-graphql/examples/users/list.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-graphql/examples/users/update-email-verification.md new file mode 100644 index 0000000000..cda7278ac0 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-email-verification.md @@ -0,0 +1,38 @@ +mutation { + usersUpdateEmailVerification( + userId: "<USER_ID>", + emailVerification: false + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-email.md b/docs/examples/1.7.x/server-graphql/examples/users/update-email.md new file mode 100644 index 0000000000..408a74972b --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-email.md @@ -0,0 +1,38 @@ +mutation { + usersUpdateEmail( + userId: "<USER_ID>", + email: "email@example.com" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-labels.md b/docs/examples/1.7.x/server-graphql/examples/users/update-labels.md new file mode 100644 index 0000000000..cb3c5b6483 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-labels.md @@ -0,0 +1,38 @@ +mutation { + usersUpdateLabels( + userId: "<USER_ID>", + labels: [] + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-graphql/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..dbef2bd345 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,7 @@ +mutation { + usersUpdateMfaRecoveryCodes( + userId: "<USER_ID>" + ) { + recoveryCodes + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-mfa.md b/docs/examples/1.7.x/server-graphql/examples/users/update-mfa.md new file mode 100644 index 0000000000..ac09ea19a4 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-mfa.md @@ -0,0 +1,38 @@ +mutation { + usersUpdateMfa( + userId: "<USER_ID>", + mfa: false + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-name.md b/docs/examples/1.7.x/server-graphql/examples/users/update-name.md new file mode 100644 index 0000000000..ec7e3dc27c --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-name.md @@ -0,0 +1,38 @@ +mutation { + usersUpdateName( + userId: "<USER_ID>", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-password.md b/docs/examples/1.7.x/server-graphql/examples/users/update-password.md new file mode 100644 index 0000000000..95ef74c83d --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-password.md @@ -0,0 +1,38 @@ +mutation { + usersUpdatePassword( + userId: "<USER_ID>", + password: "" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-graphql/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..c6afa54ba4 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-phone-verification.md @@ -0,0 +1,38 @@ +mutation { + usersUpdatePhoneVerification( + userId: "<USER_ID>", + phoneVerification: false + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-phone.md b/docs/examples/1.7.x/server-graphql/examples/users/update-phone.md new file mode 100644 index 0000000000..d3fc7d5f37 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-phone.md @@ -0,0 +1,38 @@ +mutation { + usersUpdatePhone( + userId: "<USER_ID>", + number: "+12065550100" + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-prefs.md b/docs/examples/1.7.x/server-graphql/examples/users/update-prefs.md new file mode 100644 index 0000000000..431664c2a1 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-prefs.md @@ -0,0 +1,8 @@ +mutation { + usersUpdatePrefs( + userId: "<USER_ID>", + prefs: "{}" + ) { + data + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-status.md b/docs/examples/1.7.x/server-graphql/examples/users/update-status.md new file mode 100644 index 0000000000..2499c1c258 --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-status.md @@ -0,0 +1,38 @@ +mutation { + usersUpdateStatus( + userId: "<USER_ID>", + status: false + ) { + _id + _createdAt + _updatedAt + name + password + hash + hashOptions + registration + status + labels + passwordUpdate + email + phone + emailVerification + phoneVerification + mfa + prefs { + data + } + targets { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } + accessedAt + } +} diff --git a/docs/examples/1.7.x/server-graphql/examples/users/update-target.md b/docs/examples/1.7.x/server-graphql/examples/users/update-target.md new file mode 100644 index 0000000000..1f7cc1147a --- /dev/null +++ b/docs/examples/1.7.x/server-graphql/examples/users/update-target.md @@ -0,0 +1,19 @@ +mutation { + usersUpdateTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>", + identifier: "<IDENTIFIER>", + providerId: "<PROVIDER_ID>", + name: "<NAME>" + ) { + _id + _createdAt + _updatedAt + name + userId + providerId + providerType + identifier + expired + } +} diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-anonymous-session.md b/docs/examples/1.7.x/server-kotlin/java/account/create-anonymous-session.md new file mode 100644 index 0000000000..d65c20a600 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-anonymous-session.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.createAnonymousSession(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-email-password-session.md b/docs/examples/1.7.x/server-kotlin/java/account/create-email-password-session.md new file mode 100644 index 0000000000..633931089f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-email-password-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.createEmailPasswordSession( + "email@example.com", // email + "password", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-email-token.md b/docs/examples/1.7.x/server-kotlin/java/account/create-email-token.md new file mode 100644 index 0000000000..7a6a0d7fea --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-email-token.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.createEmailToken( + "<USER_ID>", // userId + "email@example.com", // email + false, // phrase (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-j-w-t.md b/docs/examples/1.7.x/server-kotlin/java/account/create-j-w-t.md new file mode 100644 index 0000000000..3756edee25 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-j-w-t.md @@ -0,0 +1,18 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.createJWT(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-kotlin/java/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..df021f9568 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-magic-u-r-l-token.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.createMagicURLToken( + "<USER_ID>", // userId + "email@example.com", // email + "https://example.com", // url (optional) + false, // phrase (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-kotlin/java/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..ee37e48794 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-mfa-authenticator.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.createMfaAuthenticator( + AuthenticatorType.TOTP, // type + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-kotlin/java/account/create-mfa-challenge.md new file mode 100644 index 0000000000..4a07e26e49 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-mfa-challenge.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticationFactor; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.createMfaChallenge( + AuthenticationFactor.EMAIL, // factor + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/java/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..eb76cdca9b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-mfa-recovery-codes.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.createMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-o-auth2token.md b/docs/examples/1.7.x/server-kotlin/java/account/create-o-auth2token.md new file mode 100644 index 0000000000..5b325f5c61 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-o-auth2token.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.OAuthProvider; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.createOAuth2Token( + OAuthProvider.AMAZON, // provider + "https://example.com", // success (optional) + "https://example.com", // failure (optional) + listOf(), // scopes (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-phone-token.md b/docs/examples/1.7.x/server-kotlin/java/account/create-phone-token.md new file mode 100644 index 0000000000..14fb812687 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-phone-token.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.createPhoneToken( + "<USER_ID>", // userId + "+12065550100", // phone + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-phone-verification.md b/docs/examples/1.7.x/server-kotlin/java/account/create-phone-verification.md new file mode 100644 index 0000000000..9e49c62880 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-phone-verification.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.createPhoneVerification(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-recovery.md b/docs/examples/1.7.x/server-kotlin/java/account/create-recovery.md new file mode 100644 index 0000000000..f529ea4cb7 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-recovery.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.createRecovery( + "email@example.com", // email + "https://example.com", // url + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-session.md b/docs/examples/1.7.x/server-kotlin/java/account/create-session.md new file mode 100644 index 0000000000..5bcdf99059 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.createSession( + "<USER_ID>", // userId + "<SECRET>", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create-verification.md b/docs/examples/1.7.x/server-kotlin/java/account/create-verification.md new file mode 100644 index 0000000000..65c8e8be49 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create-verification.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.createVerification( + "https://example.com", // url + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/create.md b/docs/examples/1.7.x/server-kotlin/java/account/create.md new file mode 100644 index 0000000000..d24bfb8592 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/create.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.create( + "<USER_ID>", // userId + "email@example.com", // email + "", // password + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/delete-identity.md b/docs/examples/1.7.x/server-kotlin/java/account/delete-identity.md new file mode 100644 index 0000000000..0d6f860a63 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/delete-identity.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.deleteIdentity( + "<IDENTITY_ID>", // identityId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-kotlin/java/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..06835f6680 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/delete-mfa-authenticator.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.deleteMfaAuthenticator( + AuthenticatorType.TOTP, // type + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/delete-session.md b/docs/examples/1.7.x/server-kotlin/java/account/delete-session.md new file mode 100644 index 0000000000..fd27d746b1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/delete-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.deleteSession( + "<SESSION_ID>", // sessionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/delete-sessions.md b/docs/examples/1.7.x/server-kotlin/java/account/delete-sessions.md new file mode 100644 index 0000000000..11076e72d2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/delete-sessions.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.deleteSessions(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/java/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..c818c3ea74 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/get-mfa-recovery-codes.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.getMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/get-prefs.md b/docs/examples/1.7.x/server-kotlin/java/account/get-prefs.md new file mode 100644 index 0000000000..6614f92aaa --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/get-prefs.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.getPrefs(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/get-session.md b/docs/examples/1.7.x/server-kotlin/java/account/get-session.md new file mode 100644 index 0000000000..3f30d90256 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/get-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.getSession( + "<SESSION_ID>", // sessionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/get.md b/docs/examples/1.7.x/server-kotlin/java/account/get.md new file mode 100644 index 0000000000..70e2dfb97f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/get.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.get(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/list-identities.md b/docs/examples/1.7.x/server-kotlin/java/account/list-identities.md new file mode 100644 index 0000000000..ceb4b3099a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/list-identities.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.listIdentities( + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/list-logs.md b/docs/examples/1.7.x/server-kotlin/java/account/list-logs.md new file mode 100644 index 0000000000..de22fcec6a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/list-logs.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.listLogs( + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/list-mfa-factors.md b/docs/examples/1.7.x/server-kotlin/java/account/list-mfa-factors.md new file mode 100644 index 0000000000..d9f90a4127 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/list-mfa-factors.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.listMfaFactors(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/list-sessions.md b/docs/examples/1.7.x/server-kotlin/java/account/list-sessions.md new file mode 100644 index 0000000000..557832df82 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/list-sessions.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.listSessions(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-email.md b/docs/examples/1.7.x/server-kotlin/java/account/update-email.md new file mode 100644 index 0000000000..8529ba6a26 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-email.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateEmail( + "email@example.com", // email + "password", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-m-f-a.md b/docs/examples/1.7.x/server-kotlin/java/account/update-m-f-a.md new file mode 100644 index 0000000000..d1b60c5473 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-m-f-a.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateMFA( + false, // mfa + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-kotlin/java/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..b4735f49ea --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-magic-u-r-l-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.updateMagicURLSession( + "<USER_ID>", // userId + "<SECRET>", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-kotlin/java/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..947c85a244 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-mfa-authenticator.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateMfaAuthenticator( + AuthenticatorType.TOTP, // type + "<OTP>", // otp + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-kotlin/java/account/update-mfa-challenge.md new file mode 100644 index 0000000000..b9b0ae9db5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-mfa-challenge.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateMfaChallenge( + "<CHALLENGE_ID>", // challengeId + "<OTP>", // otp + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/java/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..4b3e52700b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-mfa-recovery-codes.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateMfaRecoveryCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-name.md b/docs/examples/1.7.x/server-kotlin/java/account/update-name.md new file mode 100644 index 0000000000..749fe268af --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-name.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateName( + "<NAME>", // name + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-password.md b/docs/examples/1.7.x/server-kotlin/java/account/update-password.md new file mode 100644 index 0000000000..8eaa08b460 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-password.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updatePassword( + "", // password + "password", // oldPassword (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-phone-session.md b/docs/examples/1.7.x/server-kotlin/java/account/update-phone-session.md new file mode 100644 index 0000000000..cbfdca58ec --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-phone-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>"); // Your project ID + +Account account = new Account(client); + +account.updatePhoneSession( + "<USER_ID>", // userId + "<SECRET>", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-phone-verification.md b/docs/examples/1.7.x/server-kotlin/java/account/update-phone-verification.md new file mode 100644 index 0000000000..998826544a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-phone-verification.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updatePhoneVerification( + "<USER_ID>", // userId + "<SECRET>", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-phone.md b/docs/examples/1.7.x/server-kotlin/java/account/update-phone.md new file mode 100644 index 0000000000..d54aa9cfb2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-phone.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updatePhone( + "+12065550100", // phone + "password", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-prefs.md b/docs/examples/1.7.x/server-kotlin/java/account/update-prefs.md new file mode 100644 index 0000000000..0e900d0a66 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-prefs.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updatePrefs( + mapOf( "a" to "b" ), // prefs + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-recovery.md b/docs/examples/1.7.x/server-kotlin/java/account/update-recovery.md new file mode 100644 index 0000000000..8ab16e18ce --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-recovery.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateRecovery( + "<USER_ID>", // userId + "<SECRET>", // secret + "", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-session.md b/docs/examples/1.7.x/server-kotlin/java/account/update-session.md new file mode 100644 index 0000000000..8233c054f5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateSession( + "<SESSION_ID>", // sessionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-status.md b/docs/examples/1.7.x/server-kotlin/java/account/update-status.md new file mode 100644 index 0000000000..d5f4f79476 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-status.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateStatus(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/account/update-verification.md b/docs/examples/1.7.x/server-kotlin/java/account/update-verification.md new file mode 100644 index 0000000000..dafe6db457 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/account/update-verification.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Account; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Account account = new Account(client); + +account.updateVerification( + "<USER_ID>", // userId + "<SECRET>", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/avatars/get-browser.md b/docs/examples/1.7.x/server-kotlin/java/avatars/get-browser.md new file mode 100644 index 0000000000..9c3433eef5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/avatars/get-browser.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; +import io.appwrite.enums.Browser; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +avatars.getBrowser( + Browser.AVANT_BROWSER, // code + 0, // width (optional) + 0, // height (optional) + -1, // quality (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/avatars/get-credit-card.md b/docs/examples/1.7.x/server-kotlin/java/avatars/get-credit-card.md new file mode 100644 index 0000000000..6904638106 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/avatars/get-credit-card.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; +import io.appwrite.enums.CreditCard; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +avatars.getCreditCard( + CreditCard.AMERICAN_EXPRESS, // code + 0, // width (optional) + 0, // height (optional) + -1, // quality (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/avatars/get-favicon.md b/docs/examples/1.7.x/server-kotlin/java/avatars/get-favicon.md new file mode 100644 index 0000000000..f4e89cfadc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/avatars/get-favicon.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +avatars.getFavicon( + "https://example.com", // url + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/avatars/get-flag.md b/docs/examples/1.7.x/server-kotlin/java/avatars/get-flag.md new file mode 100644 index 0000000000..159dcdcde6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/avatars/get-flag.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; +import io.appwrite.enums.Flag; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +avatars.getFlag( + Flag.AFGHANISTAN, // code + 0, // width (optional) + 0, // height (optional) + -1, // quality (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/avatars/get-image.md b/docs/examples/1.7.x/server-kotlin/java/avatars/get-image.md new file mode 100644 index 0000000000..afad760c38 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/avatars/get-image.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +avatars.getImage( + "https://example.com", // url + 0, // width (optional) + 0, // height (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/avatars/get-initials.md b/docs/examples/1.7.x/server-kotlin/java/avatars/get-initials.md new file mode 100644 index 0000000000..171b636f02 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/avatars/get-initials.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +avatars.getInitials( + "<NAME>", // name (optional) + 0, // width (optional) + 0, // height (optional) + "", // background (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/avatars/get-q-r.md b/docs/examples/1.7.x/server-kotlin/java/avatars/get-q-r.md new file mode 100644 index 0000000000..113fd1fceb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/avatars/get-q-r.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Avatars; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Avatars avatars = new Avatars(client); + +avatars.getQR( + "<TEXT>", // text + 1, // size (optional) + 0, // margin (optional) + false, // download (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..7585471443 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-boolean-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createBooleanAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + false, // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-collection.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-collection.md new file mode 100644 index 0000000000..8ec51e698a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-collection.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createCollection( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "<NAME>", // name + listOf("read("any")"), // permissions (optional) + false, // documentSecurity (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..d95e048b09 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-datetime-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createDatetimeAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + "", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-document.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-document.md new file mode 100644 index 0000000000..368b816219 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-document.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("<YOUR_API_KEY>") // Your secret API key + .setJWT("<YOUR_JWT>"); // Your secret JSON Web Token + +Databases databases = new Databases(client); + +databases.createDocument( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "<DOCUMENT_ID>", // documentId + mapOf( "a" to "b" ), // data + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-documents.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-documents.md new file mode 100644 index 0000000000..d816af366d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-documents.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createDocuments( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + listOf(), // documents + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-email-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-email-attribute.md new file mode 100644 index 0000000000..b2ecc99a17 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-email-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createEmailAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + "email@example.com", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-enum-attribute.md new file mode 100644 index 0000000000..44202086b0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-enum-attribute.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createEnumAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + listOf(), // elements + false, // required + "<DEFAULT>", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-float-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-float-attribute.md new file mode 100644 index 0000000000..2263cdb5c6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-float-attribute.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createFloatAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + 0, // min (optional) + 0, // max (optional) + 0, // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-index.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-index.md new file mode 100644 index 0000000000..fe2d9bf66d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-index.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; +import io.appwrite.enums.IndexType; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createIndex( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + IndexType.KEY, // type + listOf(), // attributes + listOf(), // orders (optional) + listOf(), // lengths (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-integer-attribute.md new file mode 100644 index 0000000000..b084e7c974 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-integer-attribute.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createIntegerAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + 0, // min (optional) + 0, // max (optional) + 0, // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-ip-attribute.md new file mode 100644 index 0000000000..ba62dba1d7 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-ip-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createIpAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + "", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..a67f452647 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-relationship-attribute.md @@ -0,0 +1,31 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; +import io.appwrite.enums.RelationshipType; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createRelationshipAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "<RELATED_COLLECTION_ID>", // relatedCollectionId + RelationshipType.ONETOONE, // type + false, // twoWay (optional) + "", // key (optional) + "", // twoWayKey (optional) + RelationMutate.CASCADE, // onDelete (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-string-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-string-attribute.md new file mode 100644 index 0000000000..3286c7aa01 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-string-attribute.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createStringAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + 1, // size + false, // required + "<DEFAULT>", // default (optional) + false, // array (optional) + false, // encrypt (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create-url-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/create-url-attribute.md new file mode 100644 index 0000000000..d445d67e33 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create-url-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.createUrlAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + "https://example.com", // default (optional) + false, // array (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/create.md b/docs/examples/1.7.x/server-kotlin/java/databases/create.md new file mode 100644 index 0000000000..31cd37e169 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/create.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.create( + "<DATABASE_ID>", // databaseId + "<NAME>", // name + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/delete-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/delete-attribute.md new file mode 100644 index 0000000000..236d492adb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/delete-attribute.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.deleteAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/delete-collection.md b/docs/examples/1.7.x/server-kotlin/java/databases/delete-collection.md new file mode 100644 index 0000000000..5da2a3d684 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/delete-collection.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.deleteCollection( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/delete-document.md b/docs/examples/1.7.x/server-kotlin/java/databases/delete-document.md new file mode 100644 index 0000000000..f6e6209f36 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/delete-document.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Databases databases = new Databases(client); + +databases.deleteDocument( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "<DOCUMENT_ID>", // documentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/delete-documents.md b/docs/examples/1.7.x/server-kotlin/java/databases/delete-documents.md new file mode 100644 index 0000000000..e8394b1ff9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/delete-documents.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.deleteDocuments( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/delete-index.md b/docs/examples/1.7.x/server-kotlin/java/databases/delete-index.md new file mode 100644 index 0000000000..6f68435779 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/delete-index.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.deleteIndex( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/delete.md b/docs/examples/1.7.x/server-kotlin/java/databases/delete.md new file mode 100644 index 0000000000..b082491383 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/delete.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.delete( + "<DATABASE_ID>", // databaseId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/get-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/get-attribute.md new file mode 100644 index 0000000000..672f0b062e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/get-attribute.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.getAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/get-collection.md b/docs/examples/1.7.x/server-kotlin/java/databases/get-collection.md new file mode 100644 index 0000000000..59401be370 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/get-collection.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.getCollection( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/get-document.md b/docs/examples/1.7.x/server-kotlin/java/databases/get-document.md new file mode 100644 index 0000000000..2719073a7d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/get-document.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Databases databases = new Databases(client); + +databases.getDocument( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "<DOCUMENT_ID>", // documentId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/get-index.md b/docs/examples/1.7.x/server-kotlin/java/databases/get-index.md new file mode 100644 index 0000000000..61cfe84ee4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/get-index.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.getIndex( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/get.md b/docs/examples/1.7.x/server-kotlin/java/databases/get.md new file mode 100644 index 0000000000..b0e3742149 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/get.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.get( + "<DATABASE_ID>", // databaseId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/list-attributes.md b/docs/examples/1.7.x/server-kotlin/java/databases/list-attributes.md new file mode 100644 index 0000000000..9681831a35 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/list-attributes.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.listAttributes( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/list-collections.md b/docs/examples/1.7.x/server-kotlin/java/databases/list-collections.md new file mode 100644 index 0000000000..32534474e1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/list-collections.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.listCollections( + "<DATABASE_ID>", // databaseId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/list-documents.md b/docs/examples/1.7.x/server-kotlin/java/databases/list-documents.md new file mode 100644 index 0000000000..36982c0eb0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/list-documents.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Databases databases = new Databases(client); + +databases.listDocuments( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/list-indexes.md b/docs/examples/1.7.x/server-kotlin/java/databases/list-indexes.md new file mode 100644 index 0000000000..8c912bb36c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/list-indexes.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.listIndexes( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/list.md b/docs/examples/1.7.x/server-kotlin/java/databases/list.md new file mode 100644 index 0000000000..758b9f75fe --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/list.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.list( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..3c95851027 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-boolean-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateBooleanAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + false, // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-collection.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-collection.md new file mode 100644 index 0000000000..6805c1149d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-collection.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateCollection( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "<NAME>", // name + listOf("read("any")"), // permissions (optional) + false, // documentSecurity (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..3f451b83f2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-datetime-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateDatetimeAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + "", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-document.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-document.md new file mode 100644 index 0000000000..f7b05c9601 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-document.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Databases databases = new Databases(client); + +databases.updateDocument( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "<DOCUMENT_ID>", // documentId + mapOf( "a" to "b" ), // data (optional) + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-documents.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-documents.md new file mode 100644 index 0000000000..b4138b41d2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-documents.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateDocuments( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + mapOf( "a" to "b" ), // data (optional) + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-email-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-email-attribute.md new file mode 100644 index 0000000000..1ff12217ba --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-email-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateEmailAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + "email@example.com", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-enum-attribute.md new file mode 100644 index 0000000000..89606806d9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-enum-attribute.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateEnumAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + listOf(), // elements + false, // required + "<DEFAULT>", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-float-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-float-attribute.md new file mode 100644 index 0000000000..0076987f85 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-float-attribute.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateFloatAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + 0, // default + 0, // min (optional) + 0, // max (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-integer-attribute.md new file mode 100644 index 0000000000..c39af22b36 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-integer-attribute.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateIntegerAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + 0, // default + 0, // min (optional) + 0, // max (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-ip-attribute.md new file mode 100644 index 0000000000..44b4da2abc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-ip-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateIpAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + "", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..8af20e91a9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-relationship-attribute.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateRelationshipAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + RelationMutate.CASCADE, // onDelete (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-string-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-string-attribute.md new file mode 100644 index 0000000000..1f156f3dbb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-string-attribute.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateStringAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + "<DEFAULT>", // default + 1, // size (optional) + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update-url-attribute.md b/docs/examples/1.7.x/server-kotlin/java/databases/update-url-attribute.md new file mode 100644 index 0000000000..959054ab48 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update-url-attribute.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.updateUrlAttribute( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + "", // key + false, // required + "https://example.com", // default + "", // newKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/update.md b/docs/examples/1.7.x/server-kotlin/java/databases/update.md new file mode 100644 index 0000000000..9928dae6f6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/update.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.update( + "<DATABASE_ID>", // databaseId + "<NAME>", // name + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/databases/upsert-documents.md b/docs/examples/1.7.x/server-kotlin/java/databases/upsert-documents.md new file mode 100644 index 0000000000..e2f2a46337 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/databases/upsert-documents.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Databases; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Databases databases = new Databases(client); + +databases.upsertDocuments( + "<DATABASE_ID>", // databaseId + "<COLLECTION_ID>", // collectionId + listOf(), // documents (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/create-deployment.md b/docs/examples/1.7.x/server-kotlin/java/functions/create-deployment.md new file mode 100644 index 0000000000..6e435f41fa --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/create-deployment.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.models.InputFile; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.createDeployment( + "<FUNCTION_ID>", // functionId + InputFile.fromPath("file.png"), // code + false, // activate + "<ENTRYPOINT>", // entrypoint (optional) + "<COMMANDS>", // commands (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-kotlin/java/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..6b9d9a131a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/create-duplicate-deployment.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.createDuplicateDeployment( + "<FUNCTION_ID>", // functionId + "<DEPLOYMENT_ID>", // deploymentId + "<BUILD_ID>", // buildId (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/create-execution.md b/docs/examples/1.7.x/server-kotlin/java/functions/create-execution.md new file mode 100644 index 0000000000..82d48fa55b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/create-execution.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Functions functions = new Functions(client); + +functions.createExecution( + "<FUNCTION_ID>", // functionId + "<BODY>", // body (optional) + false, // async (optional) + "<PATH>", // path (optional) + ExecutionMethod.GET, // method (optional) + mapOf( "a" to "b" ), // headers (optional) + "", // scheduledAt (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/create-template-deployment.md b/docs/examples/1.7.x/server-kotlin/java/functions/create-template-deployment.md new file mode 100644 index 0000000000..53b5a9ae6a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/create-template-deployment.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.createTemplateDeployment( + "<FUNCTION_ID>", // functionId + "<REPOSITORY>", // repository + "<OWNER>", // owner + "<ROOT_DIRECTORY>", // rootDirectory + "<VERSION>", // version + false, // activate (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/create-variable.md b/docs/examples/1.7.x/server-kotlin/java/functions/create-variable.md new file mode 100644 index 0000000000..70764fbdc8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/create-variable.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.createVariable( + "<FUNCTION_ID>", // functionId + "<KEY>", // key + "<VALUE>", // value + false, // secret (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-kotlin/java/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..9274cd88c7 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/create-vcs-deployment.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; +import io.appwrite.enums.VCSDeploymentType; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.createVcsDeployment( + "<FUNCTION_ID>", // functionId + VCSDeploymentType.BRANCH, // type + "<REFERENCE>", // reference + false, // activate (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/create.md b/docs/examples/1.7.x/server-kotlin/java/functions/create.md new file mode 100644 index 0000000000..71871287bb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/create.md @@ -0,0 +1,41 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; +import io.appwrite.enums.Runtime; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.create( + "<FUNCTION_ID>", // functionId + "<NAME>", // name + .NODE_14_5, // runtime + listOf("any"), // execute (optional) + listOf(), // events (optional) + "", // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + "<ENTRYPOINT>", // entrypoint (optional) + "<COMMANDS>", // commands (optional) + listOf(), // scopes (optional) + "<INSTALLATION_ID>", // installationId (optional) + "<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional) + "<PROVIDER_BRANCH>", // providerBranch (optional) + false, // providerSilentMode (optional) + "<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional) + "", // specification (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/delete-deployment.md b/docs/examples/1.7.x/server-kotlin/java/functions/delete-deployment.md new file mode 100644 index 0000000000..1a6279ff3f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/delete-deployment.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.deleteDeployment( + "<FUNCTION_ID>", // functionId + "<DEPLOYMENT_ID>", // deploymentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/delete-execution.md b/docs/examples/1.7.x/server-kotlin/java/functions/delete-execution.md new file mode 100644 index 0000000000..68f81e8ee4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/delete-execution.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.deleteExecution( + "<FUNCTION_ID>", // functionId + "<EXECUTION_ID>", // executionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/delete-variable.md b/docs/examples/1.7.x/server-kotlin/java/functions/delete-variable.md new file mode 100644 index 0000000000..c881bdc800 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/delete-variable.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.deleteVariable( + "<FUNCTION_ID>", // functionId + "<VARIABLE_ID>", // variableId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/delete.md b/docs/examples/1.7.x/server-kotlin/java/functions/delete.md new file mode 100644 index 0000000000..255fc002fa --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/delete.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.delete( + "<FUNCTION_ID>", // functionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/get-deployment-download.md b/docs/examples/1.7.x/server-kotlin/java/functions/get-deployment-download.md new file mode 100644 index 0000000000..d522b12caf --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/get-deployment-download.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.getDeploymentDownload( + "<FUNCTION_ID>", // functionId + "<DEPLOYMENT_ID>", // deploymentId + DeploymentDownloadType.SOURCE, // type (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/get-deployment.md b/docs/examples/1.7.x/server-kotlin/java/functions/get-deployment.md new file mode 100644 index 0000000000..b3000272b4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/get-deployment.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.getDeployment( + "<FUNCTION_ID>", // functionId + "<DEPLOYMENT_ID>", // deploymentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/get-execution.md b/docs/examples/1.7.x/server-kotlin/java/functions/get-execution.md new file mode 100644 index 0000000000..76e302fa82 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/get-execution.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Functions functions = new Functions(client); + +functions.getExecution( + "<FUNCTION_ID>", // functionId + "<EXECUTION_ID>", // executionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/get-variable.md b/docs/examples/1.7.x/server-kotlin/java/functions/get-variable.md new file mode 100644 index 0000000000..d54882b293 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/get-variable.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.getVariable( + "<FUNCTION_ID>", // functionId + "<VARIABLE_ID>", // variableId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/get.md b/docs/examples/1.7.x/server-kotlin/java/functions/get.md new file mode 100644 index 0000000000..aa55b93e07 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/get.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.get( + "<FUNCTION_ID>", // functionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/list-deployments.md b/docs/examples/1.7.x/server-kotlin/java/functions/list-deployments.md new file mode 100644 index 0000000000..16a10ca4a2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/list-deployments.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.listDeployments( + "<FUNCTION_ID>", // functionId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/list-executions.md b/docs/examples/1.7.x/server-kotlin/java/functions/list-executions.md new file mode 100644 index 0000000000..25a9af80aa --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/list-executions.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Functions functions = new Functions(client); + +functions.listExecutions( + "<FUNCTION_ID>", // functionId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/list-runtimes.md b/docs/examples/1.7.x/server-kotlin/java/functions/list-runtimes.md new file mode 100644 index 0000000000..304a90d0da --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/list-runtimes.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.listRuntimes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/list-specifications.md b/docs/examples/1.7.x/server-kotlin/java/functions/list-specifications.md new file mode 100644 index 0000000000..e6c9c091d7 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/list-specifications.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.listSpecifications(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/list-variables.md b/docs/examples/1.7.x/server-kotlin/java/functions/list-variables.md new file mode 100644 index 0000000000..98c9ff4527 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/list-variables.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.listVariables( + "<FUNCTION_ID>", // functionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/list.md b/docs/examples/1.7.x/server-kotlin/java/functions/list.md new file mode 100644 index 0000000000..a9a320660d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/list.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.list( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/update-deployment-status.md b/docs/examples/1.7.x/server-kotlin/java/functions/update-deployment-status.md new file mode 100644 index 0000000000..8755fd9305 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/update-deployment-status.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.updateDeploymentStatus( + "<FUNCTION_ID>", // functionId + "<DEPLOYMENT_ID>", // deploymentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/update-function-deployment.md b/docs/examples/1.7.x/server-kotlin/java/functions/update-function-deployment.md new file mode 100644 index 0000000000..b88e87c1b9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/update-function-deployment.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.updateFunctionDeployment( + "<FUNCTION_ID>", // functionId + "<DEPLOYMENT_ID>", // deploymentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/update-variable.md b/docs/examples/1.7.x/server-kotlin/java/functions/update-variable.md new file mode 100644 index 0000000000..3a2b281332 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/update-variable.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.updateVariable( + "<FUNCTION_ID>", // functionId + "<VARIABLE_ID>", // variableId + "<KEY>", // key + "<VALUE>", // value (optional) + false, // secret (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/functions/update.md b/docs/examples/1.7.x/server-kotlin/java/functions/update.md new file mode 100644 index 0000000000..5956c57b73 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/functions/update.md @@ -0,0 +1,40 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Functions; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Functions functions = new Functions(client); + +functions.update( + "<FUNCTION_ID>", // functionId + "<NAME>", // name + .NODE_14_5, // runtime (optional) + listOf("any"), // execute (optional) + listOf(), // events (optional) + "", // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + "<ENTRYPOINT>", // entrypoint (optional) + "<COMMANDS>", // commands (optional) + listOf(), // scopes (optional) + "<INSTALLATION_ID>", // installationId (optional) + "<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional) + "<PROVIDER_BRANCH>", // providerBranch (optional) + false, // providerSilentMode (optional) + "<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional) + "", // specification (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/graphql/mutation.md b/docs/examples/1.7.x/server-kotlin/java/graphql/mutation.md new file mode 100644 index 0000000000..778892457b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/graphql/mutation.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Graphql; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Graphql graphql = new Graphql(client); + +graphql.mutation( + mapOf( "a" to "b" ), // query + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/graphql/query.md b/docs/examples/1.7.x/server-kotlin/java/graphql/query.md new file mode 100644 index 0000000000..e109d523f8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/graphql/query.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Graphql; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Graphql graphql = new Graphql(client); + +graphql.query( + mapOf( "a" to "b" ), // query + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-antivirus.md b/docs/examples/1.7.x/server-kotlin/java/health/get-antivirus.md new file mode 100644 index 0000000000..ca3abf7100 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-antivirus.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getAntivirus(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-cache.md b/docs/examples/1.7.x/server-kotlin/java/health/get-cache.md new file mode 100644 index 0000000000..24a584c04b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-cache.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getCache(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-certificate.md b/docs/examples/1.7.x/server-kotlin/java/health/get-certificate.md new file mode 100644 index 0000000000..f4cb5a4e1e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-certificate.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getCertificate( + "", // domain (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-d-b.md b/docs/examples/1.7.x/server-kotlin/java/health/get-d-b.md new file mode 100644 index 0000000000..c7a7bef903 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-d-b.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getDB(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-failed-jobs.md b/docs/examples/1.7.x/server-kotlin/java/health/get-failed-jobs.md new file mode 100644 index 0000000000..d2b81bd0bf --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-failed-jobs.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; +import io.appwrite.enums.Name; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getFailedJobs( + .V1_DATABASE, // name + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-pub-sub.md b/docs/examples/1.7.x/server-kotlin/java/health/get-pub-sub.md new file mode 100644 index 0000000000..70210c4296 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-pub-sub.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getPubSub(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-builds.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-builds.md new file mode 100644 index 0000000000..2ca5d7f4e4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-builds.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueBuilds( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-certificates.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-certificates.md new file mode 100644 index 0000000000..519817ae46 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-certificates.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueCertificates( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-databases.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-databases.md new file mode 100644 index 0000000000..2f175668eb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-databases.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueDatabases( + "<NAME>", // name (optional) + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-deletes.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-deletes.md new file mode 100644 index 0000000000..e65aa9a528 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-deletes.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueDeletes( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-functions.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-functions.md new file mode 100644 index 0000000000..720f114acb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-functions.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueFunctions( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-logs.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-logs.md new file mode 100644 index 0000000000..09b0de4e63 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-logs.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueLogs( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-mails.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-mails.md new file mode 100644 index 0000000000..b1ae357aef --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-mails.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueMails( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-messaging.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-messaging.md new file mode 100644 index 0000000000..61c0b8cad7 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-messaging.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueMessaging( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-migrations.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-migrations.md new file mode 100644 index 0000000000..0e7d669e7f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-migrations.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueMigrations( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..e2f8062fcc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-stats-resources.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueStatsResources( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-usage.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-usage.md new file mode 100644 index 0000000000..bfda61a544 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-usage.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueUsage( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-webhooks.md new file mode 100644 index 0000000000..d9aed66db6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-queue-webhooks.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getQueueWebhooks( + 0, // threshold (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-storage-local.md b/docs/examples/1.7.x/server-kotlin/java/health/get-storage-local.md new file mode 100644 index 0000000000..65367cc252 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-storage-local.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getStorageLocal(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-storage.md b/docs/examples/1.7.x/server-kotlin/java/health/get-storage.md new file mode 100644 index 0000000000..3a0f0f8ed3 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-storage.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getStorage(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get-time.md b/docs/examples/1.7.x/server-kotlin/java/health/get-time.md new file mode 100644 index 0000000000..f0ba668ab8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get-time.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.getTime(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/health/get.md b/docs/examples/1.7.x/server-kotlin/java/health/get.md new file mode 100644 index 0000000000..87a7c0a32d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/health/get.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Health; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Health health = new Health(client); + +health.get(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/locale/get.md b/docs/examples/1.7.x/server-kotlin/java/locale/get.md new file mode 100644 index 0000000000..2d5e0ac06d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/locale/get.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +locale.get(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/locale/list-codes.md b/docs/examples/1.7.x/server-kotlin/java/locale/list-codes.md new file mode 100644 index 0000000000..9f07d1dbf1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/locale/list-codes.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +locale.listCodes(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/locale/list-continents.md b/docs/examples/1.7.x/server-kotlin/java/locale/list-continents.md new file mode 100644 index 0000000000..5d9e4b0fdb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/locale/list-continents.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +locale.listContinents(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-kotlin/java/locale/list-countries-e-u.md new file mode 100644 index 0000000000..232a0ef8cf --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/locale/list-countries-e-u.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +locale.listCountriesEU(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/locale/list-countries-phones.md b/docs/examples/1.7.x/server-kotlin/java/locale/list-countries-phones.md new file mode 100644 index 0000000000..a4739a5b93 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/locale/list-countries-phones.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +locale.listCountriesPhones(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/locale/list-countries.md b/docs/examples/1.7.x/server-kotlin/java/locale/list-countries.md new file mode 100644 index 0000000000..5b8f250f3c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/locale/list-countries.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +locale.listCountries(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/locale/list-currencies.md b/docs/examples/1.7.x/server-kotlin/java/locale/list-currencies.md new file mode 100644 index 0000000000..adf1d787c1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/locale/list-currencies.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +locale.listCurrencies(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/locale/list-languages.md b/docs/examples/1.7.x/server-kotlin/java/locale/list-languages.md new file mode 100644 index 0000000000..c92ea525f7 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/locale/list-languages.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Locale; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Locale locale = new Locale(client); + +locale.listLanguages(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-apns-provider.md new file mode 100644 index 0000000000..0f6618079f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-apns-provider.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createApnsProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "<AUTH_KEY>", // authKey (optional) + "<AUTH_KEY_ID>", // authKeyId (optional) + "<TEAM_ID>", // teamId (optional) + "<BUNDLE_ID>", // bundleId (optional) + false, // sandbox (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-email.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-email.md new file mode 100644 index 0000000000..d6ab5ee1bf --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-email.md @@ -0,0 +1,34 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createEmail( + "<MESSAGE_ID>", // messageId + "<SUBJECT>", // subject + "<CONTENT>", // content + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + listOf(), // cc (optional) + listOf(), // bcc (optional) + listOf(), // attachments (optional) + false, // draft (optional) + false, // html (optional) + "", // scheduledAt (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..636a1bdd39 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-fcm-provider.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createFcmProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + mapOf( "a" to "b" ), // serviceAccountJSON (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..272f9d2356 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-mailgun-provider.md @@ -0,0 +1,32 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createMailgunProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "<API_KEY>", // apiKey (optional) + "<DOMAIN>", // domain (optional) + false, // isEuRegion (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // replyToName (optional) + "email@example.com", // replyToEmail (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-msg91provider.md new file mode 100644 index 0000000000..21005293ea --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-msg91provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createMsg91Provider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "<TEMPLATE_ID>", // templateId (optional) + "<SENDER_ID>", // senderId (optional) + "<AUTH_KEY>", // authKey (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-push.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-push.md new file mode 100644 index 0000000000..277ab9655c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-push.md @@ -0,0 +1,41 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createPush( + "<MESSAGE_ID>", // messageId + "<TITLE>", // title (optional) + "<BODY>", // body (optional) + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + mapOf( "a" to "b" ), // data (optional) + "<ACTION>", // action (optional) + "[ID1:ID2]", // image (optional) + "<ICON>", // icon (optional) + "<SOUND>", // sound (optional) + "<COLOR>", // color (optional) + "<TAG>", // tag (optional) + 0, // badge (optional) + false, // draft (optional) + "", // scheduledAt (optional) + false, // contentAvailable (optional) + false, // critical (optional) + MessagePriority.NORMAL, // priority (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..84c5bf42f9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-sendgrid-provider.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createSendgridProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "<API_KEY>", // apiKey (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // replyToName (optional) + "email@example.com", // replyToEmail (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-sms.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-sms.md new file mode 100644 index 0000000000..9e3e3bdf5d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-sms.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createSms( + "<MESSAGE_ID>", // messageId + "<CONTENT>", // content + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + false, // draft (optional) + "", // scheduledAt (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..ebd153c29c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-smtp-provider.md @@ -0,0 +1,36 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createSmtpProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "<HOST>", // host + 1, // port (optional) + "<USERNAME>", // username (optional) + "<PASSWORD>", // password (optional) + SmtpEncryption.NONE, // encryption (optional) + false, // autoTLS (optional) + "<MAILER>", // mailer (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // replyToName (optional) + "email@example.com", // replyToEmail (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-subscriber.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-subscriber.md new file mode 100644 index 0000000000..1ccb8fe60c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-subscriber.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setJWT("<YOUR_JWT>"); // Your secret JSON Web Token + +Messaging messaging = new Messaging(client); + +messaging.createSubscriber( + "<TOPIC_ID>", // topicId + "<SUBSCRIBER_ID>", // subscriberId + "<TARGET_ID>", // targetId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..6b64499419 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-telesign-provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createTelesignProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "+12065550100", // from (optional) + "<CUSTOMER_ID>", // customerId (optional) + "<API_KEY>", // apiKey (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..477d7d8c4b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-textmagic-provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createTextmagicProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "+12065550100", // from (optional) + "<USERNAME>", // username (optional) + "<API_KEY>", // apiKey (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-topic.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-topic.md new file mode 100644 index 0000000000..63a24b467d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-topic.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createTopic( + "<TOPIC_ID>", // topicId + "<NAME>", // name + listOf("any"), // subscribe (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..8d1b4da970 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-twilio-provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createTwilioProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "+12065550100", // from (optional) + "<ACCOUNT_SID>", // accountSid (optional) + "<AUTH_TOKEN>", // authToken (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..db1e476db2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/create-vonage-provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.createVonageProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name + "+12065550100", // from (optional) + "<API_KEY>", // apiKey (optional) + "<API_SECRET>", // apiSecret (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/delete-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/delete-provider.md new file mode 100644 index 0000000000..b0fa837feb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/delete-provider.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.deleteProvider( + "<PROVIDER_ID>", // providerId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-kotlin/java/messaging/delete-subscriber.md new file mode 100644 index 0000000000..a3635b9db7 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/delete-subscriber.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setJWT("<YOUR_JWT>"); // Your secret JSON Web Token + +Messaging messaging = new Messaging(client); + +messaging.deleteSubscriber( + "<TOPIC_ID>", // topicId + "<SUBSCRIBER_ID>", // subscriberId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/delete-topic.md b/docs/examples/1.7.x/server-kotlin/java/messaging/delete-topic.md new file mode 100644 index 0000000000..7b598b25f4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/delete-topic.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.deleteTopic( + "<TOPIC_ID>", // topicId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/delete.md b/docs/examples/1.7.x/server-kotlin/java/messaging/delete.md new file mode 100644 index 0000000000..1395a39245 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/delete.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.delete( + "<MESSAGE_ID>", // messageId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/get-message.md b/docs/examples/1.7.x/server-kotlin/java/messaging/get-message.md new file mode 100644 index 0000000000..3860ff2347 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/get-message.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.getMessage( + "<MESSAGE_ID>", // messageId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/get-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/get-provider.md new file mode 100644 index 0000000000..9717b90b7d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/get-provider.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.getProvider( + "<PROVIDER_ID>", // providerId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/get-subscriber.md b/docs/examples/1.7.x/server-kotlin/java/messaging/get-subscriber.md new file mode 100644 index 0000000000..641a494b5c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/get-subscriber.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.getSubscriber( + "<TOPIC_ID>", // topicId + "<SUBSCRIBER_ID>", // subscriberId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/get-topic.md b/docs/examples/1.7.x/server-kotlin/java/messaging/get-topic.md new file mode 100644 index 0000000000..c9f2eff74b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/get-topic.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.getTopic( + "<TOPIC_ID>", // topicId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/list-message-logs.md b/docs/examples/1.7.x/server-kotlin/java/messaging/list-message-logs.md new file mode 100644 index 0000000000..0f94e46cd1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/list-message-logs.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listMessageLogs( + "<MESSAGE_ID>", // messageId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/list-messages.md b/docs/examples/1.7.x/server-kotlin/java/messaging/list-messages.md new file mode 100644 index 0000000000..006ba7c27f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/list-messages.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listMessages( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-kotlin/java/messaging/list-provider-logs.md new file mode 100644 index 0000000000..5f77f2d03d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/list-provider-logs.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listProviderLogs( + "<PROVIDER_ID>", // providerId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/list-providers.md b/docs/examples/1.7.x/server-kotlin/java/messaging/list-providers.md new file mode 100644 index 0000000000..b069dda04c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/list-providers.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listProviders( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-kotlin/java/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..b10e446a66 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/list-subscriber-logs.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listSubscriberLogs( + "<SUBSCRIBER_ID>", // subscriberId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/list-subscribers.md b/docs/examples/1.7.x/server-kotlin/java/messaging/list-subscribers.md new file mode 100644 index 0000000000..52ca5b0d01 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/list-subscribers.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listSubscribers( + "<TOPIC_ID>", // topicId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/list-targets.md b/docs/examples/1.7.x/server-kotlin/java/messaging/list-targets.md new file mode 100644 index 0000000000..5b9f40e873 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/list-targets.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listTargets( + "<MESSAGE_ID>", // messageId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-kotlin/java/messaging/list-topic-logs.md new file mode 100644 index 0000000000..b2e9444419 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/list-topic-logs.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listTopicLogs( + "<TOPIC_ID>", // topicId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/list-topics.md b/docs/examples/1.7.x/server-kotlin/java/messaging/list-topics.md new file mode 100644 index 0000000000..e6408a60e1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/list-topics.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.listTopics( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-apns-provider.md new file mode 100644 index 0000000000..737a142495 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-apns-provider.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateApnsProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<AUTH_KEY>", // authKey (optional) + "<AUTH_KEY_ID>", // authKeyId (optional) + "<TEAM_ID>", // teamId (optional) + "<BUNDLE_ID>", // bundleId (optional) + false, // sandbox (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-email.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-email.md new file mode 100644 index 0000000000..56e9767861 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-email.md @@ -0,0 +1,34 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateEmail( + "<MESSAGE_ID>", // messageId + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + "<SUBJECT>", // subject (optional) + "<CONTENT>", // content (optional) + false, // draft (optional) + false, // html (optional) + listOf(), // cc (optional) + listOf(), // bcc (optional) + "", // scheduledAt (optional) + listOf(), // attachments (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..68c56ef18e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-fcm-provider.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateFcmProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + mapOf( "a" to "b" ), // serviceAccountJSON (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..5547ae8575 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-mailgun-provider.md @@ -0,0 +1,32 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateMailgunProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + "<API_KEY>", // apiKey (optional) + "<DOMAIN>", // domain (optional) + false, // isEuRegion (optional) + false, // enabled (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // replyToName (optional) + "<REPLY_TO_EMAIL>", // replyToEmail (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-msg91provider.md new file mode 100644 index 0000000000..d8e485629b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-msg91provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateMsg91Provider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<TEMPLATE_ID>", // templateId (optional) + "<SENDER_ID>", // senderId (optional) + "<AUTH_KEY>", // authKey (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-push.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-push.md new file mode 100644 index 0000000000..b7038de6a4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-push.md @@ -0,0 +1,41 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updatePush( + "<MESSAGE_ID>", // messageId + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + "<TITLE>", // title (optional) + "<BODY>", // body (optional) + mapOf( "a" to "b" ), // data (optional) + "<ACTION>", // action (optional) + "[ID1:ID2]", // image (optional) + "<ICON>", // icon (optional) + "<SOUND>", // sound (optional) + "<COLOR>", // color (optional) + "<TAG>", // tag (optional) + 0, // badge (optional) + false, // draft (optional) + "", // scheduledAt (optional) + false, // contentAvailable (optional) + false, // critical (optional) + MessagePriority.NORMAL, // priority (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..14a4e99f5b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-sendgrid-provider.md @@ -0,0 +1,30 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateSendgridProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<API_KEY>", // apiKey (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // replyToName (optional) + "<REPLY_TO_EMAIL>", // replyToEmail (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-sms.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-sms.md new file mode 100644 index 0000000000..c55cfdfddb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-sms.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateSms( + "<MESSAGE_ID>", // messageId + listOf(), // topics (optional) + listOf(), // users (optional) + listOf(), // targets (optional) + "<CONTENT>", // content (optional) + false, // draft (optional) + "", // scheduledAt (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..3f39661024 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-smtp-provider.md @@ -0,0 +1,36 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateSmtpProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + "<HOST>", // host (optional) + 1, // port (optional) + "<USERNAME>", // username (optional) + "<PASSWORD>", // password (optional) + SmtpEncryption.NONE, // encryption (optional) + false, // autoTLS (optional) + "<MAILER>", // mailer (optional) + "<FROM_NAME>", // fromName (optional) + "email@example.com", // fromEmail (optional) + "<REPLY_TO_NAME>", // replyToName (optional) + "<REPLY_TO_EMAIL>", // replyToEmail (optional) + false, // enabled (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..8181bf1c82 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-telesign-provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateTelesignProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<CUSTOMER_ID>", // customerId (optional) + "<API_KEY>", // apiKey (optional) + "<FROM>", // from (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..bc156b7a31 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-textmagic-provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateTextmagicProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<USERNAME>", // username (optional) + "<API_KEY>", // apiKey (optional) + "<FROM>", // from (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-topic.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-topic.md new file mode 100644 index 0000000000..be9c44dc23 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-topic.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateTopic( + "<TOPIC_ID>", // topicId + "<NAME>", // name (optional) + listOf("any"), // subscribe (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..ed58ee9a24 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-twilio-provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateTwilioProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<ACCOUNT_SID>", // accountSid (optional) + "<AUTH_TOKEN>", // authToken (optional) + "<FROM>", // from (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-kotlin/java/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..d5bfe3610c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/messaging/update-vonage-provider.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Messaging; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Messaging messaging = new Messaging(client); + +messaging.updateVonageProvider( + "<PROVIDER_ID>", // providerId + "<NAME>", // name (optional) + false, // enabled (optional) + "<API_KEY>", // apiKey (optional) + "<API_SECRET>", // apiSecret (optional) + "<FROM>", // from (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/create-deployment.md b/docs/examples/1.7.x/server-kotlin/java/sites/create-deployment.md new file mode 100644 index 0000000000..f370f802eb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/create-deployment.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.models.InputFile; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.createDeployment( + "<SITE_ID>", // siteId + InputFile.fromPath("file.png"), // code + false, // activate + "<INSTALL_COMMAND>", // installCommand (optional) + "<BUILD_COMMAND>", // buildCommand (optional) + "<OUTPUT_DIRECTORY>", // outputDirectory (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-kotlin/java/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..35e43b8943 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/create-duplicate-deployment.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.createDuplicateDeployment( + "<SITE_ID>", // siteId + "<DEPLOYMENT_ID>", // deploymentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/create-template-deployment.md b/docs/examples/1.7.x/server-kotlin/java/sites/create-template-deployment.md new file mode 100644 index 0000000000..63aba4a067 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/create-template-deployment.md @@ -0,0 +1,28 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.createTemplateDeployment( + "<SITE_ID>", // siteId + "<REPOSITORY>", // repository + "<OWNER>", // owner + "<ROOT_DIRECTORY>", // rootDirectory + "<VERSION>", // version + false, // activate (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/create-variable.md b/docs/examples/1.7.x/server-kotlin/java/sites/create-variable.md new file mode 100644 index 0000000000..c77bec3796 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/create-variable.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.createVariable( + "<SITE_ID>", // siteId + "<KEY>", // key + "<VALUE>", // value + false, // secret (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-kotlin/java/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..754eb26419 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/create-vcs-deployment.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; +import io.appwrite.enums.VCSDeploymentType; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.createVcsDeployment( + "<SITE_ID>", // siteId + VCSDeploymentType.BRANCH, // type + "<REFERENCE>", // reference + false, // activate (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/create.md b/docs/examples/1.7.x/server-kotlin/java/sites/create.md new file mode 100644 index 0000000000..19664ec57b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/create.md @@ -0,0 +1,42 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; +import io.appwrite.enums.Framework; +import io.appwrite.enums.BuildRuntime; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.create( + "<SITE_ID>", // siteId + "<NAME>", // name + .ANALOG, // framework + .NODE_14_5, // buildRuntime + false, // enabled (optional) + false, // logging (optional) + 1, // timeout (optional) + "<INSTALL_COMMAND>", // installCommand (optional) + "<BUILD_COMMAND>", // buildCommand (optional) + "<OUTPUT_DIRECTORY>", // outputDirectory (optional) + .STATIC, // adapter (optional) + "<INSTALLATION_ID>", // installationId (optional) + "<FALLBACK_FILE>", // fallbackFile (optional) + "<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional) + "<PROVIDER_BRANCH>", // providerBranch (optional) + false, // providerSilentMode (optional) + "<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional) + "", // specification (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/delete-deployment.md b/docs/examples/1.7.x/server-kotlin/java/sites/delete-deployment.md new file mode 100644 index 0000000000..97c08ab159 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/delete-deployment.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.deleteDeployment( + "<SITE_ID>", // siteId + "<DEPLOYMENT_ID>", // deploymentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/delete-log.md b/docs/examples/1.7.x/server-kotlin/java/sites/delete-log.md new file mode 100644 index 0000000000..d7189373b0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/delete-log.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.deleteLog( + "<SITE_ID>", // siteId + "<LOG_ID>", // logId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/delete-variable.md b/docs/examples/1.7.x/server-kotlin/java/sites/delete-variable.md new file mode 100644 index 0000000000..4e2b3ab7d4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/delete-variable.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.deleteVariable( + "<SITE_ID>", // siteId + "<VARIABLE_ID>", // variableId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/delete.md b/docs/examples/1.7.x/server-kotlin/java/sites/delete.md new file mode 100644 index 0000000000..fd07bb23c8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/delete.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.delete( + "<SITE_ID>", // siteId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/get-deployment-download.md b/docs/examples/1.7.x/server-kotlin/java/sites/get-deployment-download.md new file mode 100644 index 0000000000..5875c7262f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/get-deployment-download.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.getDeploymentDownload( + "<SITE_ID>", // siteId + "<DEPLOYMENT_ID>", // deploymentId + DeploymentDownloadType.SOURCE, // type (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/get-deployment.md b/docs/examples/1.7.x/server-kotlin/java/sites/get-deployment.md new file mode 100644 index 0000000000..6af859ba9a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/get-deployment.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.getDeployment( + "<SITE_ID>", // siteId + "<DEPLOYMENT_ID>", // deploymentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/get-log.md b/docs/examples/1.7.x/server-kotlin/java/sites/get-log.md new file mode 100644 index 0000000000..d33f2a658f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/get-log.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.getLog( + "<SITE_ID>", // siteId + "<LOG_ID>", // logId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/get-variable.md b/docs/examples/1.7.x/server-kotlin/java/sites/get-variable.md new file mode 100644 index 0000000000..1c8df0c08a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/get-variable.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.getVariable( + "<SITE_ID>", // siteId + "<VARIABLE_ID>", // variableId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/get.md b/docs/examples/1.7.x/server-kotlin/java/sites/get.md new file mode 100644 index 0000000000..660cad3bdb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/get.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.get( + "<SITE_ID>", // siteId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/list-deployments.md b/docs/examples/1.7.x/server-kotlin/java/sites/list-deployments.md new file mode 100644 index 0000000000..8bcec54efe --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/list-deployments.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.listDeployments( + "<SITE_ID>", // siteId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/list-frameworks.md b/docs/examples/1.7.x/server-kotlin/java/sites/list-frameworks.md new file mode 100644 index 0000000000..df597177dd --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/list-frameworks.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.listFrameworks(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/list-logs.md b/docs/examples/1.7.x/server-kotlin/java/sites/list-logs.md new file mode 100644 index 0000000000..3532882a8d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/list-logs.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.listLogs( + "<SITE_ID>", // siteId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/list-specifications.md b/docs/examples/1.7.x/server-kotlin/java/sites/list-specifications.md new file mode 100644 index 0000000000..caad7325cf --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/list-specifications.md @@ -0,0 +1,19 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.listSpecifications(new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); +})); diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/list-variables.md b/docs/examples/1.7.x/server-kotlin/java/sites/list-variables.md new file mode 100644 index 0000000000..f2a38b7e60 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/list-variables.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.listVariables( + "<SITE_ID>", // siteId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/list.md b/docs/examples/1.7.x/server-kotlin/java/sites/list.md new file mode 100644 index 0000000000..39a1c06407 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/list.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.list( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/update-deployment-status.md b/docs/examples/1.7.x/server-kotlin/java/sites/update-deployment-status.md new file mode 100644 index 0000000000..8dc3041f76 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/update-deployment-status.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.updateDeploymentStatus( + "<SITE_ID>", // siteId + "<DEPLOYMENT_ID>", // deploymentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/update-site-deployment.md b/docs/examples/1.7.x/server-kotlin/java/sites/update-site-deployment.md new file mode 100644 index 0000000000..edbda7cf93 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/update-site-deployment.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.updateSiteDeployment( + "<SITE_ID>", // siteId + "<DEPLOYMENT_ID>", // deploymentId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/update-variable.md b/docs/examples/1.7.x/server-kotlin/java/sites/update-variable.md new file mode 100644 index 0000000000..9735ae34af --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/update-variable.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.updateVariable( + "<SITE_ID>", // siteId + "<VARIABLE_ID>", // variableId + "<KEY>", // key + "<VALUE>", // value (optional) + false, // secret (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/sites/update.md b/docs/examples/1.7.x/server-kotlin/java/sites/update.md new file mode 100644 index 0000000000..9a8b577ce0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/sites/update.md @@ -0,0 +1,41 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Sites; +import io.appwrite.enums.Framework; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Sites sites = new Sites(client); + +sites.update( + "<SITE_ID>", // siteId + "<NAME>", // name + .ANALOG, // framework + false, // enabled (optional) + false, // logging (optional) + 1, // timeout (optional) + "<INSTALL_COMMAND>", // installCommand (optional) + "<BUILD_COMMAND>", // buildCommand (optional) + "<OUTPUT_DIRECTORY>", // outputDirectory (optional) + .NODE_14_5, // buildRuntime (optional) + .STATIC, // adapter (optional) + "<FALLBACK_FILE>", // fallbackFile (optional) + "<INSTALLATION_ID>", // installationId (optional) + "<PROVIDER_REPOSITORY_ID>", // providerRepositoryId (optional) + "<PROVIDER_BRANCH>", // providerBranch (optional) + false, // providerSilentMode (optional) + "<PROVIDER_ROOT_DIRECTORY>", // providerRootDirectory (optional) + "", // specification (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/create-bucket.md b/docs/examples/1.7.x/server-kotlin/java/storage/create-bucket.md new file mode 100644 index 0000000000..a3a3308420 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/create-bucket.md @@ -0,0 +1,32 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +storage.createBucket( + "<BUCKET_ID>", // bucketId + "<NAME>", // name + listOf("read("any")"), // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + listOf(), // allowedFileExtensions (optional) + .NONE, // compression (optional) + false, // encryption (optional) + false, // antivirus (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/create-file.md b/docs/examples/1.7.x/server-kotlin/java/storage/create-file.md new file mode 100644 index 0000000000..583f8569a5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/create-file.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.models.InputFile; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +storage.createFile( + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + InputFile.fromPath("file.png"), // file + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/delete-bucket.md b/docs/examples/1.7.x/server-kotlin/java/storage/delete-bucket.md new file mode 100644 index 0000000000..eb77754f92 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/delete-bucket.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +storage.deleteBucket( + "<BUCKET_ID>", // bucketId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/delete-file.md b/docs/examples/1.7.x/server-kotlin/java/storage/delete-file.md new file mode 100644 index 0000000000..8976fd198f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/delete-file.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +storage.deleteFile( + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/get-bucket.md b/docs/examples/1.7.x/server-kotlin/java/storage/get-bucket.md new file mode 100644 index 0000000000..a099f33dd8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/get-bucket.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +storage.getBucket( + "<BUCKET_ID>", // bucketId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/get-file-download.md b/docs/examples/1.7.x/server-kotlin/java/storage/get-file-download.md new file mode 100644 index 0000000000..edda2609b5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/get-file-download.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +storage.getFileDownload( + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + "<TOKEN>", // token (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/get-file-preview.md b/docs/examples/1.7.x/server-kotlin/java/storage/get-file-preview.md new file mode 100644 index 0000000000..1a0ab596bc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/get-file-preview.md @@ -0,0 +1,36 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +storage.getFilePreview( + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + 0, // width (optional) + 0, // height (optional) + ImageGravity.CENTER, // gravity (optional) + -1, // quality (optional) + 0, // borderWidth (optional) + "", // borderColor (optional) + 0, // borderRadius (optional) + 0, // opacity (optional) + -360, // rotation (optional) + "", // background (optional) + ImageFormat.JPG, // output (optional) + "<TOKEN>", // token (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/get-file-view.md b/docs/examples/1.7.x/server-kotlin/java/storage/get-file-view.md new file mode 100644 index 0000000000..178e50776c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/get-file-view.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +storage.getFileView( + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + "<TOKEN>", // token (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/get-file.md b/docs/examples/1.7.x/server-kotlin/java/storage/get-file.md new file mode 100644 index 0000000000..7a04c80e9e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/get-file.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +storage.getFile( + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/list-buckets.md b/docs/examples/1.7.x/server-kotlin/java/storage/list-buckets.md new file mode 100644 index 0000000000..9d85957803 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/list-buckets.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +storage.listBuckets( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/list-files.md b/docs/examples/1.7.x/server-kotlin/java/storage/list-files.md new file mode 100644 index 0000000000..f002754813 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/list-files.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +storage.listFiles( + "<BUCKET_ID>", // bucketId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/update-bucket.md b/docs/examples/1.7.x/server-kotlin/java/storage/update-bucket.md new file mode 100644 index 0000000000..2d80e2648c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/update-bucket.md @@ -0,0 +1,32 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Storage storage = new Storage(client); + +storage.updateBucket( + "<BUCKET_ID>", // bucketId + "<NAME>", // name + listOf("read("any")"), // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + listOf(), // allowedFileExtensions (optional) + .NONE, // compression (optional) + false, // encryption (optional) + false, // antivirus (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/storage/update-file.md b/docs/examples/1.7.x/server-kotlin/java/storage/update-file.md new file mode 100644 index 0000000000..7f325f91fb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/storage/update-file.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Storage; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Storage storage = new Storage(client); + +storage.updateFile( + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + "<NAME>", // name (optional) + listOf("read("any")"), // permissions (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/create-membership.md b/docs/examples/1.7.x/server-kotlin/java/teams/create-membership.md new file mode 100644 index 0000000000..89e9d96ef6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/create-membership.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.createMembership( + "<TEAM_ID>", // teamId + listOf(), // roles + "email@example.com", // email (optional) + "<USER_ID>", // userId (optional) + "+12065550100", // phone (optional) + "https://example.com", // url (optional) + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/create.md b/docs/examples/1.7.x/server-kotlin/java/teams/create.md new file mode 100644 index 0000000000..28cc3dada1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/create.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.create( + "<TEAM_ID>", // teamId + "<NAME>", // name + listOf(), // roles (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/delete-membership.md b/docs/examples/1.7.x/server-kotlin/java/teams/delete-membership.md new file mode 100644 index 0000000000..3b414be028 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/delete-membership.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.deleteMembership( + "<TEAM_ID>", // teamId + "<MEMBERSHIP_ID>", // membershipId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/delete.md b/docs/examples/1.7.x/server-kotlin/java/teams/delete.md new file mode 100644 index 0000000000..07f5c12e4c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/delete.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.delete( + "<TEAM_ID>", // teamId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/get-membership.md b/docs/examples/1.7.x/server-kotlin/java/teams/get-membership.md new file mode 100644 index 0000000000..e7c1571af6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/get-membership.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.getMembership( + "<TEAM_ID>", // teamId + "<MEMBERSHIP_ID>", // membershipId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/get-prefs.md b/docs/examples/1.7.x/server-kotlin/java/teams/get-prefs.md new file mode 100644 index 0000000000..6d30814801 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/get-prefs.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.getPrefs( + "<TEAM_ID>", // teamId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/get.md b/docs/examples/1.7.x/server-kotlin/java/teams/get.md new file mode 100644 index 0000000000..a479e9aff2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/get.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.get( + "<TEAM_ID>", // teamId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/list-memberships.md b/docs/examples/1.7.x/server-kotlin/java/teams/list-memberships.md new file mode 100644 index 0000000000..9694482008 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/list-memberships.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.listMemberships( + "<TEAM_ID>", // teamId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/list.md b/docs/examples/1.7.x/server-kotlin/java/teams/list.md new file mode 100644 index 0000000000..d0855ba841 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/list.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.list( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/update-membership-status.md b/docs/examples/1.7.x/server-kotlin/java/teams/update-membership-status.md new file mode 100644 index 0000000000..461cf4cbc3 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/update-membership-status.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.updateMembershipStatus( + "<TEAM_ID>", // teamId + "<MEMBERSHIP_ID>", // membershipId + "<USER_ID>", // userId + "<SECRET>", // secret + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/update-membership.md b/docs/examples/1.7.x/server-kotlin/java/teams/update-membership.md new file mode 100644 index 0000000000..d4816c57f1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/update-membership.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.updateMembership( + "<TEAM_ID>", // teamId + "<MEMBERSHIP_ID>", // membershipId + listOf(), // roles + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/update-name.md b/docs/examples/1.7.x/server-kotlin/java/teams/update-name.md new file mode 100644 index 0000000000..f2f1b02d93 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/update-name.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.updateName( + "<TEAM_ID>", // teamId + "<NAME>", // name + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/teams/update-prefs.md b/docs/examples/1.7.x/server-kotlin/java/teams/update-prefs.md new file mode 100644 index 0000000000..2ef05222df --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/teams/update-prefs.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Teams; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession(""); // The user session to authenticate with + +Teams teams = new Teams(client); + +teams.updatePrefs( + "<TEAM_ID>", // teamId + mapOf( "a" to "b" ), // prefs + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/tokens/create-file-token.md b/docs/examples/1.7.x/server-kotlin/java/tokens/create-file-token.md new file mode 100644 index 0000000000..6996641d40 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/tokens/create-file-token.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tokens; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +tokens.createFileToken( + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + "", // expire (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/tokens/delete.md b/docs/examples/1.7.x/server-kotlin/java/tokens/delete.md new file mode 100644 index 0000000000..bf1874d2f8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/tokens/delete.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tokens; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +tokens.delete( + "<TOKEN_ID>", // tokenId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/tokens/get.md b/docs/examples/1.7.x/server-kotlin/java/tokens/get.md new file mode 100644 index 0000000000..c55563c2e1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/tokens/get.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tokens; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +tokens.get( + "<TOKEN_ID>", // tokenId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/tokens/list.md b/docs/examples/1.7.x/server-kotlin/java/tokens/list.md new file mode 100644 index 0000000000..a59e9f5ee8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/tokens/list.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tokens; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +tokens.list( + "<BUCKET_ID>", // bucketId + "<FILE_ID>", // fileId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/tokens/update.md b/docs/examples/1.7.x/server-kotlin/java/tokens/update.md new file mode 100644 index 0000000000..2a44f2d16e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/tokens/update.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Tokens; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Tokens tokens = new Tokens(client); + +tokens.update( + "<TOKEN_ID>", // tokenId + "", // expire (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-argon2user.md b/docs/examples/1.7.x/server-kotlin/java/users/create-argon2user.md new file mode 100644 index 0000000000..c78f236cec --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-argon2user.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createArgon2User( + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-kotlin/java/users/create-bcrypt-user.md new file mode 100644 index 0000000000..7b85f96054 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-bcrypt-user.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createBcryptUser( + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-j-w-t.md b/docs/examples/1.7.x/server-kotlin/java/users/create-j-w-t.md new file mode 100644 index 0000000000..2b4d7e9c50 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-j-w-t.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createJWT( + "<USER_ID>", // userId + "<SESSION_ID>", // sessionId (optional) + 0, // duration (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-m-d5user.md b/docs/examples/1.7.x/server-kotlin/java/users/create-m-d5user.md new file mode 100644 index 0000000000..666e10792e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-m-d5user.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createMD5User( + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/java/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..62afec2a1f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-mfa-recovery-codes.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createMfaRecoveryCodes( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-kotlin/java/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..048ba39cca --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-p-h-pass-user.md @@ -0,0 +1,26 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createPHPassUser( + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-kotlin/java/users/create-s-h-a-user.md new file mode 100644 index 0000000000..ad729071c2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-s-h-a-user.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createSHAUser( + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + PasswordHash.SHA1, // passwordVersion (optional) + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-kotlin/java/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..77a7d5fdb3 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-scrypt-modified-user.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createScryptModifiedUser( + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<PASSWORD_SALT>", // passwordSalt + "<PASSWORD_SALT_SEPARATOR>", // passwordSaltSeparator + "<PASSWORD_SIGNER_KEY>", // passwordSignerKey + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-scrypt-user.md b/docs/examples/1.7.x/server-kotlin/java/users/create-scrypt-user.md new file mode 100644 index 0000000000..0e81237ecf --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-scrypt-user.md @@ -0,0 +1,31 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createScryptUser( + "<USER_ID>", // userId + "email@example.com", // email + "password", // password + "<PASSWORD_SALT>", // passwordSalt + 0, // passwordCpu + 0, // passwordMemory + 0, // passwordParallel + 0, // passwordLength + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-session.md b/docs/examples/1.7.x/server-kotlin/java/users/create-session.md new file mode 100644 index 0000000000..8d9ce03d8e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-session.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createSession( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-target.md b/docs/examples/1.7.x/server-kotlin/java/users/create-target.md new file mode 100644 index 0000000000..6681b170da --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-target.md @@ -0,0 +1,29 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; +import io.appwrite.enums.MessagingProviderType; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createTarget( + "<USER_ID>", // userId + "<TARGET_ID>", // targetId + MessagingProviderType.EMAIL, // providerType + "<IDENTIFIER>", // identifier + "<PROVIDER_ID>", // providerId (optional) + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create-token.md b/docs/examples/1.7.x/server-kotlin/java/users/create-token.md new file mode 100644 index 0000000000..330b344b15 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create-token.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.createToken( + "<USER_ID>", // userId + 4, // length (optional) + 60, // expire (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/create.md b/docs/examples/1.7.x/server-kotlin/java/users/create.md new file mode 100644 index 0000000000..95a72bf7e0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/create.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.create( + "<USER_ID>", // userId + "email@example.com", // email (optional) + "+12065550100", // phone (optional) + "", // password (optional) + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/delete-identity.md b/docs/examples/1.7.x/server-kotlin/java/users/delete-identity.md new file mode 100644 index 0000000000..40c410db47 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/delete-identity.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.deleteIdentity( + "<IDENTITY_ID>", // identityId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-kotlin/java/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..7ed33d6d82 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/delete-mfa-authenticator.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; +import io.appwrite.enums.AuthenticatorType; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.deleteMfaAuthenticator( + "<USER_ID>", // userId + AuthenticatorType.TOTP, // type + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/delete-session.md b/docs/examples/1.7.x/server-kotlin/java/users/delete-session.md new file mode 100644 index 0000000000..0e0a52baf8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/delete-session.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.deleteSession( + "<USER_ID>", // userId + "<SESSION_ID>", // sessionId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/delete-sessions.md b/docs/examples/1.7.x/server-kotlin/java/users/delete-sessions.md new file mode 100644 index 0000000000..6a3bbbf46f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/delete-sessions.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.deleteSessions( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/delete-target.md b/docs/examples/1.7.x/server-kotlin/java/users/delete-target.md new file mode 100644 index 0000000000..e38ee1d57d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/delete-target.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.deleteTarget( + "<USER_ID>", // userId + "<TARGET_ID>", // targetId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/delete.md b/docs/examples/1.7.x/server-kotlin/java/users/delete.md new file mode 100644 index 0000000000..d207f9af4b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/delete.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.delete( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/java/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..940dafee90 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/get-mfa-recovery-codes.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.getMfaRecoveryCodes( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/get-prefs.md b/docs/examples/1.7.x/server-kotlin/java/users/get-prefs.md new file mode 100644 index 0000000000..9ff3e4b308 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/get-prefs.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.getPrefs( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/get-target.md b/docs/examples/1.7.x/server-kotlin/java/users/get-target.md new file mode 100644 index 0000000000..05c802835d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/get-target.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.getTarget( + "<USER_ID>", // userId + "<TARGET_ID>", // targetId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/get.md b/docs/examples/1.7.x/server-kotlin/java/users/get.md new file mode 100644 index 0000000000..d8cd707c9c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/get.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.get( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/list-identities.md b/docs/examples/1.7.x/server-kotlin/java/users/list-identities.md new file mode 100644 index 0000000000..e0fc9d122a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/list-identities.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.listIdentities( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/list-logs.md b/docs/examples/1.7.x/server-kotlin/java/users/list-logs.md new file mode 100644 index 0000000000..86c94ee3a4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/list-logs.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.listLogs( + "<USER_ID>", // userId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/list-memberships.md b/docs/examples/1.7.x/server-kotlin/java/users/list-memberships.md new file mode 100644 index 0000000000..d0cee13275 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/list-memberships.md @@ -0,0 +1,25 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.listMemberships( + "<USER_ID>", // userId + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/list-mfa-factors.md b/docs/examples/1.7.x/server-kotlin/java/users/list-mfa-factors.md new file mode 100644 index 0000000000..a377214d19 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/list-mfa-factors.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.listMfaFactors( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/list-sessions.md b/docs/examples/1.7.x/server-kotlin/java/users/list-sessions.md new file mode 100644 index 0000000000..7e13cb31c9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/list-sessions.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.listSessions( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/list-targets.md b/docs/examples/1.7.x/server-kotlin/java/users/list-targets.md new file mode 100644 index 0000000000..efa754273f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/list-targets.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.listTargets( + "<USER_ID>", // userId + listOf(), // queries (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/list.md b/docs/examples/1.7.x/server-kotlin/java/users/list.md new file mode 100644 index 0000000000..d587eaf46b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/list.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.list( + listOf(), // queries (optional) + "<SEARCH>", // search (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-email-verification.md b/docs/examples/1.7.x/server-kotlin/java/users/update-email-verification.md new file mode 100644 index 0000000000..a79c87b4d6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-email-verification.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updateEmailVerification( + "<USER_ID>", // userId + false, // emailVerification + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-email.md b/docs/examples/1.7.x/server-kotlin/java/users/update-email.md new file mode 100644 index 0000000000..24cdb00dff --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-email.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updateEmail( + "<USER_ID>", // userId + "email@example.com", // email + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-labels.md b/docs/examples/1.7.x/server-kotlin/java/users/update-labels.md new file mode 100644 index 0000000000..379200a56b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-labels.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updateLabels( + "<USER_ID>", // userId + listOf(), // labels + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/java/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..439561012f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-mfa-recovery-codes.md @@ -0,0 +1,23 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updateMfaRecoveryCodes( + "<USER_ID>", // userId + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-mfa.md b/docs/examples/1.7.x/server-kotlin/java/users/update-mfa.md new file mode 100644 index 0000000000..76a198f513 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-mfa.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updateMfa( + "<USER_ID>", // userId + false, // mfa + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-name.md b/docs/examples/1.7.x/server-kotlin/java/users/update-name.md new file mode 100644 index 0000000000..b4f889cb6d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-name.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updateName( + "<USER_ID>", // userId + "<NAME>", // name + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-password.md b/docs/examples/1.7.x/server-kotlin/java/users/update-password.md new file mode 100644 index 0000000000..94e24da45d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-password.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updatePassword( + "<USER_ID>", // userId + "", // password + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-phone-verification.md b/docs/examples/1.7.x/server-kotlin/java/users/update-phone-verification.md new file mode 100644 index 0000000000..4a1d5a2900 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-phone-verification.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updatePhoneVerification( + "<USER_ID>", // userId + false, // phoneVerification + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-phone.md b/docs/examples/1.7.x/server-kotlin/java/users/update-phone.md new file mode 100644 index 0000000000..49477fad43 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-phone.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updatePhone( + "<USER_ID>", // userId + "+12065550100", // number + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-prefs.md b/docs/examples/1.7.x/server-kotlin/java/users/update-prefs.md new file mode 100644 index 0000000000..c5a9677a20 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-prefs.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updatePrefs( + "<USER_ID>", // userId + mapOf( "a" to "b" ), // prefs + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-status.md b/docs/examples/1.7.x/server-kotlin/java/users/update-status.md new file mode 100644 index 0000000000..6e875b982f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-status.md @@ -0,0 +1,24 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updateStatus( + "<USER_ID>", // userId + false, // status + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/java/users/update-target.md b/docs/examples/1.7.x/server-kotlin/java/users/update-target.md new file mode 100644 index 0000000000..67b90bfbac --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/java/users/update-target.md @@ -0,0 +1,27 @@ +import io.appwrite.Client; +import io.appwrite.coroutines.CoroutineCallback; +import io.appwrite.services.Users; + +Client client = new Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>"); // Your secret API key + +Users users = new Users(client); + +users.updateTarget( + "<USER_ID>", // userId + "<TARGET_ID>", // targetId + "<IDENTIFIER>", // identifier (optional) + "<PROVIDER_ID>", // providerId (optional) + "<NAME>", // name (optional) + new CoroutineCallback<>((result, error) -> { + if (error != null) { + error.printStackTrace(); + return; + } + + System.out.println(result); + }) +); + diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-anonymous-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-anonymous-session.md new file mode 100644 index 0000000000..0ddc3835dc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-anonymous-session.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.createAnonymousSession() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-email-password-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-email-password-session.md new file mode 100644 index 0000000000..9c7af95e13 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-email-password-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.createEmailPasswordSession( + email = "email@example.com", + password = "password" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-email-token.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-email-token.md new file mode 100644 index 0000000000..84acd78a9c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-email-token.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.createEmailToken( + userId = "<USER_ID>", + email = "email@example.com", + phrase = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-j-w-t.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-j-w-t.md new file mode 100644 index 0000000000..4c04aa1215 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-j-w-t.md @@ -0,0 +1,11 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.createJWT() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..c1d8cba2cb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-magic-u-r-l-token.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.createMagicURLToken( + userId = "<USER_ID>", + email = "email@example.com", + url = "https://example.com", // optional + phrase = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..803579da03 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-mfa-authenticator.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticatorType + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.createMfaAuthenticator( + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-mfa-challenge.md new file mode 100644 index 0000000000..a3fbe25d75 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-mfa-challenge.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticationFactor + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.createMfaChallenge( + factor = AuthenticationFactor.EMAIL +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..c21a382fcc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.createMfaRecoveryCodes() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-o-auth2token.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-o-auth2token.md new file mode 100644 index 0000000000..1a8c1188b0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-o-auth2token.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.OAuthProvider + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +account.createOAuth2Token( + provider = OAuthProvider.AMAZON, + success = "https://example.com", // optional + failure = "https://example.com", // optional + scopes = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-phone-token.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-phone-token.md new file mode 100644 index 0000000000..be03e0659f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-phone-token.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.createPhoneToken( + userId = "<USER_ID>", + phone = "+12065550100" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-phone-verification.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-phone-verification.md new file mode 100644 index 0000000000..3ae45b3982 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-phone-verification.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.createPhoneVerification() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-recovery.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-recovery.md new file mode 100644 index 0000000000..949219cfca --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-recovery.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.createRecovery( + email = "email@example.com", + url = "https://example.com" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-session.md new file mode 100644 index 0000000000..5afb219ff0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.createSession( + userId = "<USER_ID>", + secret = "<SECRET>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create-verification.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-verification.md new file mode 100644 index 0000000000..f3441c9bdd --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create-verification.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.createVerification( + url = "https://example.com" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/create.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/create.md new file mode 100644 index 0000000000..80640ba830 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/create.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.create( + userId = "<USER_ID>", + email = "email@example.com", + password = "", + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-identity.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-identity.md new file mode 100644 index 0000000000..f9a5ce0a12 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-identity.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.deleteIdentity( + identityId = "<IDENTITY_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..2068077f46 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-mfa-authenticator.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticatorType + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.deleteMfaAuthenticator( + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-session.md new file mode 100644 index 0000000000..31096ccc65 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.deleteSession( + sessionId = "<SESSION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-sessions.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-sessions.md new file mode 100644 index 0000000000..dc29fb8aac --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/delete-sessions.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.deleteSessions() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..027c211230 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/get-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.getMfaRecoveryCodes() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/get-prefs.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/get-prefs.md new file mode 100644 index 0000000000..299abbd929 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/get-prefs.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.getPrefs() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/get-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/get-session.md new file mode 100644 index 0000000000..e40297e60c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/get-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.getSession( + sessionId = "<SESSION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/get.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/get.md new file mode 100644 index 0000000000..f65f4fd618 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/get.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.get() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/list-identities.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/list-identities.md new file mode 100644 index 0000000000..32eb86cb43 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/list-identities.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.listIdentities( + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/list-logs.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/list-logs.md new file mode 100644 index 0000000000..345b2f1f06 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/list-logs.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.listLogs( + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/list-mfa-factors.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/list-mfa-factors.md new file mode 100644 index 0000000000..ce47dcd752 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/list-mfa-factors.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.listMfaFactors() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/list-sessions.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/list-sessions.md new file mode 100644 index 0000000000..899260cd5b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/list-sessions.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.listSessions() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-email.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-email.md new file mode 100644 index 0000000000..6ebe5e7ec9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-email.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateEmail( + email = "email@example.com", + password = "password" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-m-f-a.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-m-f-a.md new file mode 100644 index 0000000000..e12e8e00e2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-m-f-a.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMFA( + mfa = false +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..d4fe7f4861 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-magic-u-r-l-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.updateMagicURLSession( + userId = "<USER_ID>", + secret = "<SECRET>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..521d133f6f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-mfa-authenticator.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account +import io.appwrite.enums.AuthenticatorType + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMfaAuthenticator( + type = AuthenticatorType.TOTP, + otp = "<OTP>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-mfa-challenge.md new file mode 100644 index 0000000000..6b978b765e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-mfa-challenge.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMfaChallenge( + challengeId = "<CHALLENGE_ID>", + otp = "<OTP>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..31da824bbf --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateMfaRecoveryCodes() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-name.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-name.md new file mode 100644 index 0000000000..ecb7a2bd2f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-name.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateName( + name = "<NAME>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-password.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-password.md new file mode 100644 index 0000000000..159aa79aef --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-password.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updatePassword( + password = "", + oldPassword = "password" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-phone-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-phone-session.md new file mode 100644 index 0000000000..1bcc4c0955 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-phone-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +val account = Account(client) + +val response = account.updatePhoneSession( + userId = "<USER_ID>", + secret = "<SECRET>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-phone-verification.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-phone-verification.md new file mode 100644 index 0000000000..36a2d9c73b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-phone-verification.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updatePhoneVerification( + userId = "<USER_ID>", + secret = "<SECRET>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-phone.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-phone.md new file mode 100644 index 0000000000..1ee4cbd39b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-phone.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updatePhone( + phone = "+12065550100", + password = "password" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-prefs.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-prefs.md new file mode 100644 index 0000000000..dafee7c0e5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-prefs.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updatePrefs( + prefs = mapOf( "a" to "b" ) +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-recovery.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-recovery.md new file mode 100644 index 0000000000..e56381365d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-recovery.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateRecovery( + userId = "<USER_ID>", + secret = "<SECRET>", + password = "" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-session.md new file mode 100644 index 0000000000..ab3730af0e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateSession( + sessionId = "<SESSION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-status.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-status.md new file mode 100644 index 0000000000..021f6143c0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-status.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateStatus() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/account/update-verification.md b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-verification.md new file mode 100644 index 0000000000..6402093410 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/account/update-verification.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Account + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val account = Account(client) + +val response = account.updateVerification( + userId = "<USER_ID>", + secret = "<SECRET>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-browser.md b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-browser.md new file mode 100644 index 0000000000..f289205ab0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-browser.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars +import io.appwrite.enums.Browser + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val avatars = Avatars(client) + +val result = avatars.getBrowser( + code = Browser.AVANT_BROWSER, + width = 0, // optional + height = 0, // optional + quality = -1 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-credit-card.md b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-credit-card.md new file mode 100644 index 0000000000..1fd00a24bd --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-credit-card.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars +import io.appwrite.enums.CreditCard + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val avatars = Avatars(client) + +val result = avatars.getCreditCard( + code = CreditCard.AMERICAN_EXPRESS, + width = 0, // optional + height = 0, // optional + quality = -1 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-favicon.md b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-favicon.md new file mode 100644 index 0000000000..d1f5d9bfe6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-favicon.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val avatars = Avatars(client) + +val result = avatars.getFavicon( + url = "https://example.com" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-flag.md b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-flag.md new file mode 100644 index 0000000000..a16aefcffd --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-flag.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars +import io.appwrite.enums.Flag + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val avatars = Avatars(client) + +val result = avatars.getFlag( + code = Flag.AFGHANISTAN, + width = 0, // optional + height = 0, // optional + quality = -1 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-image.md b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-image.md new file mode 100644 index 0000000000..98b9c07e7f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-image.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val avatars = Avatars(client) + +val result = avatars.getImage( + url = "https://example.com", + width = 0, // optional + height = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-initials.md b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-initials.md new file mode 100644 index 0000000000..2aa165ccf8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-initials.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val avatars = Avatars(client) + +val result = avatars.getInitials( + name = "<NAME>", // optional + width = 0, // optional + height = 0, // optional + background = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-q-r.md b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-q-r.md new file mode 100644 index 0000000000..abcf488cbb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/avatars/get-q-r.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Avatars + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val avatars = Avatars(client) + +val result = avatars.getQR( + text = "<TEXT>", + size = 1, // optional + margin = 0, // optional + download = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..b80bd9497a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-boolean-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createBooleanAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = false, // optional + array = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-collection.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-collection.md new file mode 100644 index 0000000000..de9679f559 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-collection.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createCollection( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + name = "<NAME>", + permissions = listOf("read("any")"), // optional + documentSecurity = false, // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..2d730562a9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-datetime-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createDatetimeAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = "", // optional + array = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-document.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-document.md new file mode 100644 index 0000000000..93da01eefa --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-document.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("<YOUR_API_KEY>") // Your secret API key + .setJWT("<YOUR_JWT>") // Your secret JSON Web Token + +val databases = Databases(client) + +val response = databases.createDocument( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documentId = "<DOCUMENT_ID>", + data = mapOf( "a" to "b" ), + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-documents.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-documents.md new file mode 100644 index 0000000000..01692c62ad --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-documents.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createDocuments( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documents = listOf() +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-email-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-email-attribute.md new file mode 100644 index 0000000000..2a5a9c2a60 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-email-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createEmailAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = "email@example.com", // optional + array = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-enum-attribute.md new file mode 100644 index 0000000000..d9decdeba9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-enum-attribute.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createEnumAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + elements = listOf(), + required = false, + default = "<DEFAULT>", // optional + array = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-float-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-float-attribute.md new file mode 100644 index 0000000000..5ca86a66af --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-float-attribute.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createFloatAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + min = 0, // optional + max = 0, // optional + default = 0, // optional + array = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-index.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-index.md new file mode 100644 index 0000000000..da777ac906 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-index.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases +import io.appwrite.enums.IndexType + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createIndex( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + type = IndexType.KEY, + attributes = listOf(), + orders = listOf(), // optional + lengths = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-integer-attribute.md new file mode 100644 index 0000000000..748d01a849 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-integer-attribute.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createIntegerAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + min = 0, // optional + max = 0, // optional + default = 0, // optional + array = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-ip-attribute.md new file mode 100644 index 0000000000..bfc610517a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-ip-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createIpAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = "", // optional + array = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..1bf610321a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-relationship-attribute.md @@ -0,0 +1,22 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases +import io.appwrite.enums.RelationshipType + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createRelationshipAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + relatedCollectionId = "<RELATED_COLLECTION_ID>", + type = RelationshipType.ONETOONE, + twoWay = false, // optional + key = "", // optional + twoWayKey = "", // optional + onDelete = "cascade" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-string-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-string-attribute.md new file mode 100644 index 0000000000..333cb76763 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-string-attribute.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createStringAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + size = 1, + required = false, + default = "<DEFAULT>", // optional + array = false, // optional + encrypt = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-url-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-url-attribute.md new file mode 100644 index 0000000000..06057d4683 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create-url-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.createUrlAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = "https://example.com", // optional + array = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/create.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create.md new file mode 100644 index 0000000000..04c64801d2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/create.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.create( + databaseId = "<DATABASE_ID>", + name = "<NAME>", + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-attribute.md new file mode 100644 index 0000000000..9a25155957 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-attribute.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.deleteAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-collection.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-collection.md new file mode 100644 index 0000000000..c46ca086b9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-collection.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.deleteCollection( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-document.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-document.md new file mode 100644 index 0000000000..a9eea6b648 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-document.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val databases = Databases(client) + +val response = databases.deleteDocument( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documentId = "<DOCUMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-documents.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-documents.md new file mode 100644 index 0000000000..c4caa63aae --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-documents.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.deleteDocuments( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-index.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-index.md new file mode 100644 index 0000000000..37c75dcfe5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete-index.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.deleteIndex( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete.md new file mode 100644 index 0000000000..07225698e2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/delete.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.delete( + databaseId = "<DATABASE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-attribute.md new file mode 100644 index 0000000000..a59facd7db --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-attribute.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.getAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-collection.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-collection.md new file mode 100644 index 0000000000..7f6e578db1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-collection.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.getCollection( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-document.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-document.md new file mode 100644 index 0000000000..d21a19869b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-document.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val databases = Databases(client) + +val response = databases.getDocument( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documentId = "<DOCUMENT_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-index.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-index.md new file mode 100644 index 0000000000..39ac7af9fb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get-index.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.getIndex( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/get.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get.md new file mode 100644 index 0000000000..6ebb0c109c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/get.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.get( + databaseId = "<DATABASE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-attributes.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-attributes.md new file mode 100644 index 0000000000..5ddb0a6fea --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-attributes.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.listAttributes( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-collections.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-collections.md new file mode 100644 index 0000000000..5340903927 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-collections.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.listCollections( + databaseId = "<DATABASE_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-documents.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-documents.md new file mode 100644 index 0000000000..ed9cb3165d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-documents.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val databases = Databases(client) + +val response = databases.listDocuments( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-indexes.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-indexes.md new file mode 100644 index 0000000000..2ab2e6a1b2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list-indexes.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.listIndexes( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/list.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list.md new file mode 100644 index 0000000000..cd61a0e714 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/list.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.list( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..4c9fd91d83 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-boolean-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateBooleanAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = false, + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-collection.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-collection.md new file mode 100644 index 0000000000..bd42ba07f4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-collection.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateCollection( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + name = "<NAME>", + permissions = listOf("read("any")"), // optional + documentSecurity = false, // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..082ae1c05a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-datetime-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateDatetimeAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = "", + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-document.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-document.md new file mode 100644 index 0000000000..4dd0349823 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-document.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val databases = Databases(client) + +val response = databases.updateDocument( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documentId = "<DOCUMENT_ID>", + data = mapOf( "a" to "b" ), // optional + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-documents.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-documents.md new file mode 100644 index 0000000000..9d6c2b5ea8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-documents.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateDocuments( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + data = mapOf( "a" to "b" ), // optional + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-email-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-email-attribute.md new file mode 100644 index 0000000000..026bd6447f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-email-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateEmailAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = "email@example.com", + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-enum-attribute.md new file mode 100644 index 0000000000..e68a29c20a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-enum-attribute.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateEnumAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + elements = listOf(), + required = false, + default = "<DEFAULT>", + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-float-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-float-attribute.md new file mode 100644 index 0000000000..58b110743e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-float-attribute.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateFloatAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = 0, + min = 0, // optional + max = 0, // optional + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-integer-attribute.md new file mode 100644 index 0000000000..a00dcf95a0 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-integer-attribute.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateIntegerAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = 0, + min = 0, // optional + max = 0, // optional + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-ip-attribute.md new file mode 100644 index 0000000000..505e5ea18d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-ip-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateIpAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = "", + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..001dd1a391 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-relationship-attribute.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateRelationshipAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + onDelete = "cascade", // optional + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-string-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-string-attribute.md new file mode 100644 index 0000000000..364a6b5b7f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-string-attribute.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateStringAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = "<DEFAULT>", + size = 1, // optional + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-url-attribute.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-url-attribute.md new file mode 100644 index 0000000000..a628cc57f8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update-url-attribute.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.updateUrlAttribute( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + key = "", + required = false, + default = "https://example.com", + newKey = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/update.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update.md new file mode 100644 index 0000000000..05f832738a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/update.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.update( + databaseId = "<DATABASE_ID>", + name = "<NAME>", + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/databases/upsert-documents.md b/docs/examples/1.7.x/server-kotlin/kotlin/databases/upsert-documents.md new file mode 100644 index 0000000000..7459b384a1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/databases/upsert-documents.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Databases + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val databases = Databases(client) + +val response = databases.upsertDocuments( + databaseId = "<DATABASE_ID>", + collectionId = "<COLLECTION_ID>", + documents = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-deployment.md new file mode 100644 index 0000000000..ddc6e8b207 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-deployment.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.models.InputFile +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.createDeployment( + functionId = "<FUNCTION_ID>", + code = InputFile.fromPath("file.png"), + activate = false, + entrypoint = "<ENTRYPOINT>", // optional + commands = "<COMMANDS>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..a3395f118f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-duplicate-deployment.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.createDuplicateDeployment( + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>", + buildId = "<BUILD_ID>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-execution.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-execution.md new file mode 100644 index 0000000000..94bfa2310c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-execution.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val functions = Functions(client) + +val response = functions.createExecution( + functionId = "<FUNCTION_ID>", + body = "<BODY>", // optional + async = false, // optional + path = "<PATH>", // optional + method = "GET", // optional + headers = mapOf( "a" to "b" ), // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-template-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-template-deployment.md new file mode 100644 index 0000000000..90c311ec7a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-template-deployment.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.createTemplateDeployment( + functionId = "<FUNCTION_ID>", + repository = "<REPOSITORY>", + owner = "<OWNER>", + rootDirectory = "<ROOT_DIRECTORY>", + version = "<VERSION>", + activate = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-variable.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-variable.md new file mode 100644 index 0000000000..061bc20534 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-variable.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.createVariable( + functionId = "<FUNCTION_ID>", + key = "<KEY>", + value = "<VALUE>", + secret = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..08bb5a3097 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create-vcs-deployment.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions +import io.appwrite.enums.VCSDeploymentType + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.createVcsDeployment( + functionId = "<FUNCTION_ID>", + type = VCSDeploymentType.BRANCH, + reference = "<REFERENCE>", + activate = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/create.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create.md new file mode 100644 index 0000000000..c0ea4de201 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/create.md @@ -0,0 +1,32 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions +import io.appwrite.enums.Runtime + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.create( + functionId = "<FUNCTION_ID>", + name = "<NAME>", + runtime = .NODE_14_5, + execute = listOf("any"), // optional + events = listOf(), // optional + schedule = "", // optional + timeout = 1, // optional + enabled = false, // optional + logging = false, // optional + entrypoint = "<ENTRYPOINT>", // optional + commands = "<COMMANDS>", // optional + scopes = listOf(), // optional + installationId = "<INSTALLATION_ID>", // optional + providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch = "<PROVIDER_BRANCH>", // optional + providerSilentMode = false, // optional + providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional + specification = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete-deployment.md new file mode 100644 index 0000000000..937fc961da --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete-deployment.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.deleteDeployment( + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete-execution.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete-execution.md new file mode 100644 index 0000000000..95994f822a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete-execution.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.deleteExecution( + functionId = "<FUNCTION_ID>", + executionId = "<EXECUTION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete-variable.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete-variable.md new file mode 100644 index 0000000000..e1793675c9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete-variable.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.deleteVariable( + functionId = "<FUNCTION_ID>", + variableId = "<VARIABLE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete.md new file mode 100644 index 0000000000..9651744767 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/delete.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.delete( + functionId = "<FUNCTION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-deployment-download.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-deployment-download.md new file mode 100644 index 0000000000..634cfae3b4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-deployment-download.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val result = functions.getDeploymentDownload( + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>", + type = "source" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-deployment.md new file mode 100644 index 0000000000..eba4abb6df --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-deployment.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.getDeployment( + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-execution.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-execution.md new file mode 100644 index 0000000000..480dbb76ba --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-execution.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val functions = Functions(client) + +val response = functions.getExecution( + functionId = "<FUNCTION_ID>", + executionId = "<EXECUTION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-variable.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-variable.md new file mode 100644 index 0000000000..95359ef8fc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get-variable.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.getVariable( + functionId = "<FUNCTION_ID>", + variableId = "<VARIABLE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/get.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get.md new file mode 100644 index 0000000000..162fa22497 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/get.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.get( + functionId = "<FUNCTION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-deployments.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-deployments.md new file mode 100644 index 0000000000..9318442afa --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-deployments.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.listDeployments( + functionId = "<FUNCTION_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-executions.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-executions.md new file mode 100644 index 0000000000..926719cda8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-executions.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val functions = Functions(client) + +val response = functions.listExecutions( + functionId = "<FUNCTION_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-runtimes.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-runtimes.md new file mode 100644 index 0000000000..5b3673b84d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-runtimes.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.listRuntimes() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-specifications.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-specifications.md new file mode 100644 index 0000000000..0b2fb46a4b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-specifications.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.listSpecifications() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-variables.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-variables.md new file mode 100644 index 0000000000..7f576e8957 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list-variables.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.listVariables( + functionId = "<FUNCTION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/list.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list.md new file mode 100644 index 0000000000..b10fdff53a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/list.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.list( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/update-deployment-status.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/update-deployment-status.md new file mode 100644 index 0000000000..0e6e9c0abe --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/update-deployment-status.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.updateDeploymentStatus( + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/update-function-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/update-function-deployment.md new file mode 100644 index 0000000000..a975e07efe --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/update-function-deployment.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.updateFunctionDeployment( + functionId = "<FUNCTION_ID>", + deploymentId = "<DEPLOYMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/update-variable.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/update-variable.md new file mode 100644 index 0000000000..106b340eb5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/update-variable.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.updateVariable( + functionId = "<FUNCTION_ID>", + variableId = "<VARIABLE_ID>", + key = "<KEY>", + value = "<VALUE>", // optional + secret = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/functions/update.md b/docs/examples/1.7.x/server-kotlin/kotlin/functions/update.md new file mode 100644 index 0000000000..7f0b33ebd7 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/functions/update.md @@ -0,0 +1,31 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Functions + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val functions = Functions(client) + +val response = functions.update( + functionId = "<FUNCTION_ID>", + name = "<NAME>", + runtime = "node-14.5", // optional + execute = listOf("any"), // optional + events = listOf(), // optional + schedule = "", // optional + timeout = 1, // optional + enabled = false, // optional + logging = false, // optional + entrypoint = "<ENTRYPOINT>", // optional + commands = "<COMMANDS>", // optional + scopes = listOf(), // optional + installationId = "<INSTALLATION_ID>", // optional + providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch = "<PROVIDER_BRANCH>", // optional + providerSilentMode = false, // optional + providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional + specification = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/graphql/mutation.md b/docs/examples/1.7.x/server-kotlin/kotlin/graphql/mutation.md new file mode 100644 index 0000000000..98081ab06b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/graphql/mutation.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Graphql + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val graphql = Graphql(client) + +val response = graphql.mutation( + query = mapOf( "a" to "b" ) +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/graphql/query.md b/docs/examples/1.7.x/server-kotlin/kotlin/graphql/query.md new file mode 100644 index 0000000000..dec8dd350c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/graphql/query.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Graphql + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val graphql = Graphql(client) + +val response = graphql.query( + query = mapOf( "a" to "b" ) +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-antivirus.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-antivirus.md new file mode 100644 index 0000000000..869b4c4804 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-antivirus.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getAntivirus() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-cache.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-cache.md new file mode 100644 index 0000000000..8b72ec414f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-cache.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getCache() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-certificate.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-certificate.md new file mode 100644 index 0000000000..74bf618704 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-certificate.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getCertificate( + domain = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-d-b.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-d-b.md new file mode 100644 index 0000000000..a55a1146f4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-d-b.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getDB() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-failed-jobs.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-failed-jobs.md new file mode 100644 index 0000000000..027df127cc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-failed-jobs.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health +import io.appwrite.enums.Name + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getFailedJobs( + name = .V1_DATABASE, + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-pub-sub.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-pub-sub.md new file mode 100644 index 0000000000..53c3820232 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-pub-sub.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getPubSub() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-builds.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-builds.md new file mode 100644 index 0000000000..371aad90f8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-builds.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueBuilds( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-certificates.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-certificates.md new file mode 100644 index 0000000000..5c6adeecb5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-certificates.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueCertificates( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-databases.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-databases.md new file mode 100644 index 0000000000..3a3405830d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-databases.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueDatabases( + name = "<NAME>", // optional + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-deletes.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-deletes.md new file mode 100644 index 0000000000..5d0b8a3381 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-deletes.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueDeletes( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-functions.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-functions.md new file mode 100644 index 0000000000..7a42b61ba5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-functions.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueFunctions( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-logs.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-logs.md new file mode 100644 index 0000000000..151025bfb6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-logs.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueLogs( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-mails.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-mails.md new file mode 100644 index 0000000000..f5a905dd73 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-mails.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueMails( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-messaging.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-messaging.md new file mode 100644 index 0000000000..4a837928eb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-messaging.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueMessaging( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-migrations.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-migrations.md new file mode 100644 index 0000000000..853d294ed1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-migrations.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueMigrations( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..6a76f528e2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-stats-resources.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueStatsResources( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-usage.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-usage.md new file mode 100644 index 0000000000..e344b9eddc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-usage.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueUsage( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-webhooks.md new file mode 100644 index 0000000000..f5ffc58d8d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-queue-webhooks.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getQueueWebhooks( + threshold = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-storage-local.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-storage-local.md new file mode 100644 index 0000000000..32a21aea0a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-storage-local.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getStorageLocal() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-storage.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-storage.md new file mode 100644 index 0000000000..8af609aad9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-storage.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getStorage() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get-time.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-time.md new file mode 100644 index 0000000000..8054ed7c69 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get-time.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.getTime() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/health/get.md b/docs/examples/1.7.x/server-kotlin/kotlin/health/get.md new file mode 100644 index 0000000000..0845320bb5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/health/get.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Health + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val health = Health(client) + +val response = health.get() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/locale/get.md b/docs/examples/1.7.x/server-kotlin/kotlin/locale/get.md new file mode 100644 index 0000000000..6840259c27 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/locale/get.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val locale = Locale(client) + +val response = locale.get() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-codes.md b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-codes.md new file mode 100644 index 0000000000..fd0c4e413e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-codes.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val locale = Locale(client) + +val response = locale.listCodes() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-continents.md b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-continents.md new file mode 100644 index 0000000000..699d599f56 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-continents.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val locale = Locale(client) + +val response = locale.listContinents() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-countries-e-u.md new file mode 100644 index 0000000000..13e86f3064 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-countries-e-u.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val locale = Locale(client) + +val response = locale.listCountriesEU() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-countries-phones.md b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-countries-phones.md new file mode 100644 index 0000000000..b660ccf433 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-countries-phones.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val locale = Locale(client) + +val response = locale.listCountriesPhones() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-countries.md b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-countries.md new file mode 100644 index 0000000000..3457ceb4c5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-countries.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val locale = Locale(client) + +val response = locale.listCountries() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-currencies.md b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-currencies.md new file mode 100644 index 0000000000..80b2cc7e52 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-currencies.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val locale = Locale(client) + +val response = locale.listCurrencies() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-languages.md b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-languages.md new file mode 100644 index 0000000000..b36c1389a5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/locale/list-languages.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Locale + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val locale = Locale(client) + +val response = locale.listLanguages() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-apns-provider.md new file mode 100644 index 0000000000..a19cbe2725 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-apns-provider.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createApnsProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + authKey = "<AUTH_KEY>", // optional + authKeyId = "<AUTH_KEY_ID>", // optional + teamId = "<TEAM_ID>", // optional + bundleId = "<BUNDLE_ID>", // optional + sandbox = false, // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-email.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-email.md new file mode 100644 index 0000000000..f0f41e9e53 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-email.md @@ -0,0 +1,25 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createEmail( + messageId = "<MESSAGE_ID>", + subject = "<SUBJECT>", + content = "<CONTENT>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + cc = listOf(), // optional + bcc = listOf(), // optional + attachments = listOf(), // optional + draft = false, // optional + html = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..c1a077ca5c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-fcm-provider.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createFcmProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + serviceAccountJSON = mapOf( "a" to "b" ), // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..d205171dfe --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-mailgun-provider.md @@ -0,0 +1,23 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createMailgunProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + apiKey = "<API_KEY>", // optional + domain = "<DOMAIN>", // optional + isEuRegion = false, // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "email@example.com", // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-msg91provider.md new file mode 100644 index 0000000000..5ea3d223e9 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-msg91provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createMsg91Provider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + templateId = "<TEMPLATE_ID>", // optional + senderId = "<SENDER_ID>", // optional + authKey = "<AUTH_KEY>", // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-push.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-push.md new file mode 100644 index 0000000000..5b07f5355b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-push.md @@ -0,0 +1,32 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createPush( + messageId = "<MESSAGE_ID>", + title = "<TITLE>", // optional + body = "<BODY>", // optional + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + data = mapOf( "a" to "b" ), // optional + action = "<ACTION>", // optional + image = "[ID1:ID2]", // optional + icon = "<ICON>", // optional + sound = "<SOUND>", // optional + color = "<COLOR>", // optional + tag = "<TAG>", // optional + badge = 0, // optional + draft = false, // optional + scheduledAt = "", // optional + contentAvailable = false, // optional + critical = false, // optional + priority = "normal" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..e96a052d5a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-sendgrid-provider.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createSendgridProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + apiKey = "<API_KEY>", // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "email@example.com", // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-sms.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-sms.md new file mode 100644 index 0000000000..49185290c3 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-sms.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createSms( + messageId = "<MESSAGE_ID>", + content = "<CONTENT>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + draft = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..ae3b6678e4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-smtp-provider.md @@ -0,0 +1,27 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createSmtpProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + host = "<HOST>", + port = 1, // optional + username = "<USERNAME>", // optional + password = "<PASSWORD>", // optional + encryption = "none", // optional + autoTLS = false, // optional + mailer = "<MAILER>", // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "email@example.com", // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-subscriber.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-subscriber.md new file mode 100644 index 0000000000..44e3a72a1d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-subscriber.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setJWT("<YOUR_JWT>") // Your secret JSON Web Token + +val messaging = Messaging(client) + +val response = messaging.createSubscriber( + topicId = "<TOPIC_ID>", + subscriberId = "<SUBSCRIBER_ID>", + targetId = "<TARGET_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..cddd6d801a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-telesign-provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createTelesignProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + from = "+12065550100", // optional + customerId = "<CUSTOMER_ID>", // optional + apiKey = "<API_KEY>", // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..12eb62d957 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-textmagic-provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createTextmagicProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + from = "+12065550100", // optional + username = "<USERNAME>", // optional + apiKey = "<API_KEY>", // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-topic.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-topic.md new file mode 100644 index 0000000000..570be33e41 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-topic.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createTopic( + topicId = "<TOPIC_ID>", + name = "<NAME>", + subscribe = listOf("any") // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..c05b835d52 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-twilio-provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createTwilioProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + from = "+12065550100", // optional + accountSid = "<ACCOUNT_SID>", // optional + authToken = "<AUTH_TOKEN>", // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..7e049d8313 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/create-vonage-provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.createVonageProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", + from = "+12065550100", // optional + apiKey = "<API_KEY>", // optional + apiSecret = "<API_SECRET>", // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete-provider.md new file mode 100644 index 0000000000..4989da8cd3 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete-provider.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.deleteProvider( + providerId = "<PROVIDER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete-subscriber.md new file mode 100644 index 0000000000..0f99f251a3 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete-subscriber.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setJWT("<YOUR_JWT>") // Your secret JSON Web Token + +val messaging = Messaging(client) + +val response = messaging.deleteSubscriber( + topicId = "<TOPIC_ID>", + subscriberId = "<SUBSCRIBER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete-topic.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete-topic.md new file mode 100644 index 0000000000..8a52c9f9a5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete-topic.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.deleteTopic( + topicId = "<TOPIC_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete.md new file mode 100644 index 0000000000..7e4ec51c93 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/delete.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.delete( + messageId = "<MESSAGE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-message.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-message.md new file mode 100644 index 0000000000..710d356113 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-message.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.getMessage( + messageId = "<MESSAGE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-provider.md new file mode 100644 index 0000000000..c678d4d984 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-provider.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.getProvider( + providerId = "<PROVIDER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-subscriber.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-subscriber.md new file mode 100644 index 0000000000..59b335a2e6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-subscriber.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.getSubscriber( + topicId = "<TOPIC_ID>", + subscriberId = "<SUBSCRIBER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-topic.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-topic.md new file mode 100644 index 0000000000..c189898e95 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/get-topic.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.getTopic( + topicId = "<TOPIC_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-message-logs.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-message-logs.md new file mode 100644 index 0000000000..e1463f8911 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-message-logs.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listMessageLogs( + messageId = "<MESSAGE_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-messages.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-messages.md new file mode 100644 index 0000000000..618f8c493e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-messages.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listMessages( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-provider-logs.md new file mode 100644 index 0000000000..ab0a9f1260 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-provider-logs.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listProviderLogs( + providerId = "<PROVIDER_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-providers.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-providers.md new file mode 100644 index 0000000000..34c70a9c86 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-providers.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listProviders( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..8a82af8f70 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-subscriber-logs.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listSubscriberLogs( + subscriberId = "<SUBSCRIBER_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-subscribers.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-subscribers.md new file mode 100644 index 0000000000..acf5249900 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-subscribers.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listSubscribers( + topicId = "<TOPIC_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-targets.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-targets.md new file mode 100644 index 0000000000..ad500f0e38 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-targets.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listTargets( + messageId = "<MESSAGE_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-topic-logs.md new file mode 100644 index 0000000000..683b418032 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-topic-logs.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listTopicLogs( + topicId = "<TOPIC_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-topics.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-topics.md new file mode 100644 index 0000000000..125c6ffb82 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/list-topics.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.listTopics( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-apns-provider.md new file mode 100644 index 0000000000..d0d5a07848 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-apns-provider.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateApnsProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + authKey = "<AUTH_KEY>", // optional + authKeyId = "<AUTH_KEY_ID>", // optional + teamId = "<TEAM_ID>", // optional + bundleId = "<BUNDLE_ID>", // optional + sandbox = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-email.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-email.md new file mode 100644 index 0000000000..cd74bb4290 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-email.md @@ -0,0 +1,25 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateEmail( + messageId = "<MESSAGE_ID>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + subject = "<SUBJECT>", // optional + content = "<CONTENT>", // optional + draft = false, // optional + html = false, // optional + cc = listOf(), // optional + bcc = listOf(), // optional + scheduledAt = "", // optional + attachments = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..477e7188d8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-fcm-provider.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateFcmProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + serviceAccountJSON = mapOf( "a" to "b" ) // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..4bec8d2a44 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-mailgun-provider.md @@ -0,0 +1,23 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateMailgunProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + apiKey = "<API_KEY>", // optional + domain = "<DOMAIN>", // optional + isEuRegion = false, // optional + enabled = false, // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "<REPLY_TO_EMAIL>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-msg91provider.md new file mode 100644 index 0000000000..3abaca75bb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-msg91provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateMsg91Provider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + templateId = "<TEMPLATE_ID>", // optional + senderId = "<SENDER_ID>", // optional + authKey = "<AUTH_KEY>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-push.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-push.md new file mode 100644 index 0000000000..710a37e518 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-push.md @@ -0,0 +1,32 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updatePush( + messageId = "<MESSAGE_ID>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + title = "<TITLE>", // optional + body = "<BODY>", // optional + data = mapOf( "a" to "b" ), // optional + action = "<ACTION>", // optional + image = "[ID1:ID2]", // optional + icon = "<ICON>", // optional + sound = "<SOUND>", // optional + color = "<COLOR>", // optional + tag = "<TAG>", // optional + badge = 0, // optional + draft = false, // optional + scheduledAt = "", // optional + contentAvailable = false, // optional + critical = false, // optional + priority = "normal" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..962aa694e6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-sendgrid-provider.md @@ -0,0 +1,21 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateSendgridProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + apiKey = "<API_KEY>", // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "<REPLY_TO_EMAIL>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-sms.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-sms.md new file mode 100644 index 0000000000..3d08b8a16c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-sms.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateSms( + messageId = "<MESSAGE_ID>", + topics = listOf(), // optional + users = listOf(), // optional + targets = listOf(), // optional + content = "<CONTENT>", // optional + draft = false, // optional + scheduledAt = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..cb745865ec --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-smtp-provider.md @@ -0,0 +1,27 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateSmtpProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + host = "<HOST>", // optional + port = 1, // optional + username = "<USERNAME>", // optional + password = "<PASSWORD>", // optional + encryption = "none", // optional + autoTLS = false, // optional + mailer = "<MAILER>", // optional + fromName = "<FROM_NAME>", // optional + fromEmail = "email@example.com", // optional + replyToName = "<REPLY_TO_NAME>", // optional + replyToEmail = "<REPLY_TO_EMAIL>", // optional + enabled = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..83fb11a856 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-telesign-provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateTelesignProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + customerId = "<CUSTOMER_ID>", // optional + apiKey = "<API_KEY>", // optional + from = "<FROM>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..1e2ee1e2c8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-textmagic-provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateTextmagicProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + username = "<USERNAME>", // optional + apiKey = "<API_KEY>", // optional + from = "<FROM>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-topic.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-topic.md new file mode 100644 index 0000000000..0991fd0ee4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-topic.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateTopic( + topicId = "<TOPIC_ID>", + name = "<NAME>", // optional + subscribe = listOf("any") // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..1c86f9e853 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-twilio-provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateTwilioProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + accountSid = "<ACCOUNT_SID>", // optional + authToken = "<AUTH_TOKEN>", // optional + from = "<FROM>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..bf0ee2b75c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/messaging/update-vonage-provider.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Messaging + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val messaging = Messaging(client) + +val response = messaging.updateVonageProvider( + providerId = "<PROVIDER_ID>", + name = "<NAME>", // optional + enabled = false, // optional + apiKey = "<API_KEY>", // optional + apiSecret = "<API_SECRET>", // optional + from = "<FROM>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-deployment.md new file mode 100644 index 0000000000..ba2c24dd6b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-deployment.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.models.InputFile +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.createDeployment( + siteId = "<SITE_ID>", + code = InputFile.fromPath("file.png"), + activate = false, + installCommand = "<INSTALL_COMMAND>", // optional + buildCommand = "<BUILD_COMMAND>", // optional + outputDirectory = "<OUTPUT_DIRECTORY>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..06a3ce8467 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-duplicate-deployment.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.createDuplicateDeployment( + siteId = "<SITE_ID>", + deploymentId = "<DEPLOYMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-template-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-template-deployment.md new file mode 100644 index 0000000000..bf246be089 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-template-deployment.md @@ -0,0 +1,19 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.createTemplateDeployment( + siteId = "<SITE_ID>", + repository = "<REPOSITORY>", + owner = "<OWNER>", + rootDirectory = "<ROOT_DIRECTORY>", + version = "<VERSION>", + activate = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-variable.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-variable.md new file mode 100644 index 0000000000..6eb466682f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-variable.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.createVariable( + siteId = "<SITE_ID>", + key = "<KEY>", + value = "<VALUE>", + secret = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..141cf3e658 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create-vcs-deployment.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites +import io.appwrite.enums.VCSDeploymentType + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.createVcsDeployment( + siteId = "<SITE_ID>", + type = VCSDeploymentType.BRANCH, + reference = "<REFERENCE>", + activate = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/create.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create.md new file mode 100644 index 0000000000..a5e9719faf --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/create.md @@ -0,0 +1,33 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites +import io.appwrite.enums.Framework +import io.appwrite.enums.BuildRuntime + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.create( + siteId = "<SITE_ID>", + name = "<NAME>", + framework = .ANALOG, + buildRuntime = .NODE_14_5, + enabled = false, // optional + logging = false, // optional + timeout = 1, // optional + installCommand = "<INSTALL_COMMAND>", // optional + buildCommand = "<BUILD_COMMAND>", // optional + outputDirectory = "<OUTPUT_DIRECTORY>", // optional + adapter = "static", // optional + installationId = "<INSTALLATION_ID>", // optional + fallbackFile = "<FALLBACK_FILE>", // optional + providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch = "<PROVIDER_BRANCH>", // optional + providerSilentMode = false, // optional + providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional + specification = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete-deployment.md new file mode 100644 index 0000000000..6d739183f1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete-deployment.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.deleteDeployment( + siteId = "<SITE_ID>", + deploymentId = "<DEPLOYMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete-log.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete-log.md new file mode 100644 index 0000000000..c7d7b77824 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete-log.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.deleteLog( + siteId = "<SITE_ID>", + logId = "<LOG_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete-variable.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete-variable.md new file mode 100644 index 0000000000..7859a8a852 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete-variable.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.deleteVariable( + siteId = "<SITE_ID>", + variableId = "<VARIABLE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete.md new file mode 100644 index 0000000000..369b6144c3 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/delete.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.delete( + siteId = "<SITE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-deployment-download.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-deployment-download.md new file mode 100644 index 0000000000..84324762cc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-deployment-download.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val result = sites.getDeploymentDownload( + siteId = "<SITE_ID>", + deploymentId = "<DEPLOYMENT_ID>", + type = "source" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-deployment.md new file mode 100644 index 0000000000..f2a33a409e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-deployment.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.getDeployment( + siteId = "<SITE_ID>", + deploymentId = "<DEPLOYMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-log.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-log.md new file mode 100644 index 0000000000..ff46f77d12 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-log.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.getLog( + siteId = "<SITE_ID>", + logId = "<LOG_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-variable.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-variable.md new file mode 100644 index 0000000000..ccab666607 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get-variable.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.getVariable( + siteId = "<SITE_ID>", + variableId = "<VARIABLE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/get.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get.md new file mode 100644 index 0000000000..7ced974ede --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/get.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.get( + siteId = "<SITE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-deployments.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-deployments.md new file mode 100644 index 0000000000..6bc29ccd0e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-deployments.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.listDeployments( + siteId = "<SITE_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-frameworks.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-frameworks.md new file mode 100644 index 0000000000..cf02b75bc2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-frameworks.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.listFrameworks() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-logs.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-logs.md new file mode 100644 index 0000000000..d7979ded39 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-logs.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.listLogs( + siteId = "<SITE_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-specifications.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-specifications.md new file mode 100644 index 0000000000..56e864059a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-specifications.md @@ -0,0 +1,12 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.listSpecifications() diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-variables.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-variables.md new file mode 100644 index 0000000000..70ec49799b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list-variables.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.listVariables( + siteId = "<SITE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/list.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list.md new file mode 100644 index 0000000000..26e965177d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/list.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.list( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/update-deployment-status.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/update-deployment-status.md new file mode 100644 index 0000000000..585fc324ed --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/update-deployment-status.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.updateDeploymentStatus( + siteId = "<SITE_ID>", + deploymentId = "<DEPLOYMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/update-site-deployment.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/update-site-deployment.md new file mode 100644 index 0000000000..fb9bb726f8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/update-site-deployment.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.updateSiteDeployment( + siteId = "<SITE_ID>", + deploymentId = "<DEPLOYMENT_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/update-variable.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/update-variable.md new file mode 100644 index 0000000000..b32c27809a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/update-variable.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.updateVariable( + siteId = "<SITE_ID>", + variableId = "<VARIABLE_ID>", + key = "<KEY>", + value = "<VALUE>", // optional + secret = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/sites/update.md b/docs/examples/1.7.x/server-kotlin/kotlin/sites/update.md new file mode 100644 index 0000000000..4b4a938d95 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/sites/update.md @@ -0,0 +1,32 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Sites +import io.appwrite.enums.Framework + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val sites = Sites(client) + +val response = sites.update( + siteId = "<SITE_ID>", + name = "<NAME>", + framework = .ANALOG, + enabled = false, // optional + logging = false, // optional + timeout = 1, // optional + installCommand = "<INSTALL_COMMAND>", // optional + buildCommand = "<BUILD_COMMAND>", // optional + outputDirectory = "<OUTPUT_DIRECTORY>", // optional + buildRuntime = "node-14.5", // optional + adapter = "static", // optional + fallbackFile = "<FALLBACK_FILE>", // optional + installationId = "<INSTALLATION_ID>", // optional + providerRepositoryId = "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch = "<PROVIDER_BRANCH>", // optional + providerSilentMode = false, // optional + providerRootDirectory = "<PROVIDER_ROOT_DIRECTORY>", // optional + specification = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/create-bucket.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/create-bucket.md new file mode 100644 index 0000000000..0bca827872 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/create-bucket.md @@ -0,0 +1,23 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val storage = Storage(client) + +val response = storage.createBucket( + bucketId = "<BUCKET_ID>", + name = "<NAME>", + permissions = listOf("read("any")"), // optional + fileSecurity = false, // optional + enabled = false, // optional + maximumFileSize = 1, // optional + allowedFileExtensions = listOf(), // optional + compression = "none", // optional + encryption = false, // optional + antivirus = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/create-file.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/create-file.md new file mode 100644 index 0000000000..b22b32a665 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/create-file.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.models.InputFile +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val storage = Storage(client) + +val response = storage.createFile( + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", + file = InputFile.fromPath("file.png"), + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/delete-bucket.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/delete-bucket.md new file mode 100644 index 0000000000..4a0904ec63 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/delete-bucket.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val storage = Storage(client) + +val response = storage.deleteBucket( + bucketId = "<BUCKET_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/delete-file.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/delete-file.md new file mode 100644 index 0000000000..cf5e285db3 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/delete-file.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val storage = Storage(client) + +val response = storage.deleteFile( + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-bucket.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-bucket.md new file mode 100644 index 0000000000..e2a6a8f527 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-bucket.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val storage = Storage(client) + +val response = storage.getBucket( + bucketId = "<BUCKET_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file-download.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file-download.md new file mode 100644 index 0000000000..c14c966b8b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file-download.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val storage = Storage(client) + +val result = storage.getFileDownload( + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", + token = "<TOKEN>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file-preview.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file-preview.md new file mode 100644 index 0000000000..45122de2f8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file-preview.md @@ -0,0 +1,27 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val storage = Storage(client) + +val result = storage.getFilePreview( + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", + width = 0, // optional + height = 0, // optional + gravity = "center", // optional + quality = -1, // optional + borderWidth = 0, // optional + borderColor = "", // optional + borderRadius = 0, // optional + opacity = 0, // optional + rotation = -360, // optional + background = "", // optional + output = "jpg", // optional + token = "<TOKEN>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file-view.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file-view.md new file mode 100644 index 0000000000..fec1ec7162 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file-view.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val storage = Storage(client) + +val result = storage.getFileView( + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", + token = "<TOKEN>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file.md new file mode 100644 index 0000000000..a807177dce --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/get-file.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val storage = Storage(client) + +val response = storage.getFile( + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/list-buckets.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/list-buckets.md new file mode 100644 index 0000000000..a8a066dc9f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/list-buckets.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val storage = Storage(client) + +val response = storage.listBuckets( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/list-files.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/list-files.md new file mode 100644 index 0000000000..cb9a776775 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/list-files.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val storage = Storage(client) + +val response = storage.listFiles( + bucketId = "<BUCKET_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/update-bucket.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/update-bucket.md new file mode 100644 index 0000000000..d475a6e5ed --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/update-bucket.md @@ -0,0 +1,23 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val storage = Storage(client) + +val response = storage.updateBucket( + bucketId = "<BUCKET_ID>", + name = "<NAME>", + permissions = listOf("read("any")"), // optional + fileSecurity = false, // optional + enabled = false, // optional + maximumFileSize = 1, // optional + allowedFileExtensions = listOf(), // optional + compression = "none", // optional + encryption = false, // optional + antivirus = false // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/storage/update-file.md b/docs/examples/1.7.x/server-kotlin/kotlin/storage/update-file.md new file mode 100644 index 0000000000..e82ea8125c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/storage/update-file.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Storage + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val storage = Storage(client) + +val response = storage.updateFile( + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", + name = "<NAME>", // optional + permissions = listOf("read("any")") // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/create-membership.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/create-membership.md new file mode 100644 index 0000000000..33eb16568e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/create-membership.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.createMembership( + teamId = "<TEAM_ID>", + roles = listOf(), + email = "email@example.com", // optional + userId = "<USER_ID>", // optional + phone = "+12065550100", // optional + url = "https://example.com", // optional + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/create.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/create.md new file mode 100644 index 0000000000..6ec7e533d2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/create.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.create( + teamId = "<TEAM_ID>", + name = "<NAME>", + roles = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/delete-membership.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/delete-membership.md new file mode 100644 index 0000000000..48c924f37b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/delete-membership.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.deleteMembership( + teamId = "<TEAM_ID>", + membershipId = "<MEMBERSHIP_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/delete.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/delete.md new file mode 100644 index 0000000000..4b70ff2f18 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/delete.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.delete( + teamId = "<TEAM_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/get-membership.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/get-membership.md new file mode 100644 index 0000000000..a636c217da --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/get-membership.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.getMembership( + teamId = "<TEAM_ID>", + membershipId = "<MEMBERSHIP_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/get-prefs.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/get-prefs.md new file mode 100644 index 0000000000..2b73432d6c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/get-prefs.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.getPrefs( + teamId = "<TEAM_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/get.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/get.md new file mode 100644 index 0000000000..72b667776f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/get.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.get( + teamId = "<TEAM_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/list-memberships.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/list-memberships.md new file mode 100644 index 0000000000..287087394e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/list-memberships.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.listMemberships( + teamId = "<TEAM_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/list.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/list.md new file mode 100644 index 0000000000..ee3e3e43b4 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/list.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.list( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-membership-status.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-membership-status.md new file mode 100644 index 0000000000..b7a0d51ec5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-membership-status.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.updateMembershipStatus( + teamId = "<TEAM_ID>", + membershipId = "<MEMBERSHIP_ID>", + userId = "<USER_ID>", + secret = "<SECRET>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-membership.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-membership.md new file mode 100644 index 0000000000..7a4377fb4d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-membership.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.updateMembership( + teamId = "<TEAM_ID>", + membershipId = "<MEMBERSHIP_ID>", + roles = listOf() +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-name.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-name.md new file mode 100644 index 0000000000..2f13d7c460 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-name.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.updateName( + teamId = "<TEAM_ID>", + name = "<NAME>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-prefs.md b/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-prefs.md new file mode 100644 index 0000000000..62c7f01ca5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/teams/update-prefs.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Teams + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +val teams = Teams(client) + +val response = teams.updatePrefs( + teamId = "<TEAM_ID>", + prefs = mapOf( "a" to "b" ) +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/tokens/create-file-token.md b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/create-file-token.md new file mode 100644 index 0000000000..63d8fc301b --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/create-file-token.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tokens + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val tokens = Tokens(client) + +val response = tokens.createFileToken( + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", + expire = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/tokens/delete.md b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/delete.md new file mode 100644 index 0000000000..1831bc6a87 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/delete.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tokens + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val tokens = Tokens(client) + +val response = tokens.delete( + tokenId = "<TOKEN_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/tokens/get.md b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/get.md new file mode 100644 index 0000000000..70a47c2349 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/get.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tokens + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val tokens = Tokens(client) + +val response = tokens.get( + tokenId = "<TOKEN_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/tokens/list.md b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/list.md new file mode 100644 index 0000000000..697579065c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/list.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tokens + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val tokens = Tokens(client) + +val response = tokens.list( + bucketId = "<BUCKET_ID>", + fileId = "<FILE_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/tokens/update.md b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/update.md new file mode 100644 index 0000000000..045ddaae4a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/tokens/update.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Tokens + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val tokens = Tokens(client) + +val response = tokens.update( + tokenId = "<TOKEN_ID>", + expire = "" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-argon2user.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-argon2user.md new file mode 100644 index 0000000000..27008a0415 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-argon2user.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createArgon2User( + userId = "<USER_ID>", + email = "email@example.com", + password = "password", + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-bcrypt-user.md new file mode 100644 index 0000000000..c7231307cf --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-bcrypt-user.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createBcryptUser( + userId = "<USER_ID>", + email = "email@example.com", + password = "password", + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-j-w-t.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-j-w-t.md new file mode 100644 index 0000000000..a556a901c5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-j-w-t.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createJWT( + userId = "<USER_ID>", + sessionId = "<SESSION_ID>", // optional + duration = 0 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-m-d5user.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-m-d5user.md new file mode 100644 index 0000000000..27b985920c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-m-d5user.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createMD5User( + userId = "<USER_ID>", + email = "email@example.com", + password = "password", + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..2d1dbf0a1d --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createMfaRecoveryCodes( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..5441e49e6c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-p-h-pass-user.md @@ -0,0 +1,17 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createPHPassUser( + userId = "<USER_ID>", + email = "email@example.com", + password = "password", + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-s-h-a-user.md new file mode 100644 index 0000000000..17a157b2cd --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-s-h-a-user.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createSHAUser( + userId = "<USER_ID>", + email = "email@example.com", + password = "password", + passwordVersion = "sha1", // optional + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..814883cae5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-scrypt-modified-user.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createScryptModifiedUser( + userId = "<USER_ID>", + email = "email@example.com", + password = "password", + passwordSalt = "<PASSWORD_SALT>", + passwordSaltSeparator = "<PASSWORD_SALT_SEPARATOR>", + passwordSignerKey = "<PASSWORD_SIGNER_KEY>", + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-scrypt-user.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-scrypt-user.md new file mode 100644 index 0000000000..619525a799 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-scrypt-user.md @@ -0,0 +1,22 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createScryptUser( + userId = "<USER_ID>", + email = "email@example.com", + password = "password", + passwordSalt = "<PASSWORD_SALT>", + passwordCpu = 0, + passwordMemory = 0, + passwordParallel = 0, + passwordLength = 0, + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-session.md new file mode 100644 index 0000000000..a67e605121 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-session.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createSession( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-target.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-target.md new file mode 100644 index 0000000000..139c6ff049 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-target.md @@ -0,0 +1,20 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users +import io.appwrite.enums.MessagingProviderType + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createTarget( + userId = "<USER_ID>", + targetId = "<TARGET_ID>", + providerType = MessagingProviderType.EMAIL, + identifier = "<IDENTIFIER>", + providerId = "<PROVIDER_ID>", // optional + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create-token.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-token.md new file mode 100644 index 0000000000..43492f4747 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create-token.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.createToken( + userId = "<USER_ID>", + length = 4, // optional + expire = 60 // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/create.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/create.md new file mode 100644 index 0000000000..27ae85ae6e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/create.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.create( + userId = "<USER_ID>", + email = "email@example.com", // optional + phone = "+12065550100", // optional + password = "", // optional + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-identity.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-identity.md new file mode 100644 index 0000000000..37b4ed2e71 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-identity.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.deleteIdentity( + identityId = "<IDENTITY_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..22085b2f72 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-mfa-authenticator.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users +import io.appwrite.enums.AuthenticatorType + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.deleteMfaAuthenticator( + userId = "<USER_ID>", + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-session.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-session.md new file mode 100644 index 0000000000..e9e3c7c55e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-session.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.deleteSession( + userId = "<USER_ID>", + sessionId = "<SESSION_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-sessions.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-sessions.md new file mode 100644 index 0000000000..6288e1bc04 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-sessions.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.deleteSessions( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-target.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-target.md new file mode 100644 index 0000000000..f93be0677a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete-target.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.deleteTarget( + userId = "<USER_ID>", + targetId = "<TARGET_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/delete.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete.md new file mode 100644 index 0000000000..b938ac70d1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/delete.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.delete( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..e0c45dc258 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/get-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.getMfaRecoveryCodes( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/get-prefs.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/get-prefs.md new file mode 100644 index 0000000000..927a4a43a1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/get-prefs.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.getPrefs( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/get-target.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/get-target.md new file mode 100644 index 0000000000..556349c684 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/get-target.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.getTarget( + userId = "<USER_ID>", + targetId = "<TARGET_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/get.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/get.md new file mode 100644 index 0000000000..70f0ee9d5f --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/get.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.get( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/list-identities.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-identities.md new file mode 100644 index 0000000000..1ac0e5b887 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-identities.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.listIdentities( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/list-logs.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-logs.md new file mode 100644 index 0000000000..a263293a7a --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-logs.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.listLogs( + userId = "<USER_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/list-memberships.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-memberships.md new file mode 100644 index 0000000000..7df13df4e2 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-memberships.md @@ -0,0 +1,16 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.listMemberships( + userId = "<USER_ID>", + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/list-mfa-factors.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-mfa-factors.md new file mode 100644 index 0000000000..4eb6721ce5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-mfa-factors.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.listMfaFactors( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/list-sessions.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-sessions.md new file mode 100644 index 0000000000..4ff34dd53e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-sessions.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.listSessions( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/list-targets.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-targets.md new file mode 100644 index 0000000000..0824acfd9e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/list-targets.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.listTargets( + userId = "<USER_ID>", + queries = listOf() // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/list.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/list.md new file mode 100644 index 0000000000..23dd217a6c --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/list.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.list( + queries = listOf(), // optional + search = "<SEARCH>" // optional +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-email-verification.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-email-verification.md new file mode 100644 index 0000000000..ebf2232f3e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-email-verification.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updateEmailVerification( + userId = "<USER_ID>", + emailVerification = false +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-email.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-email.md new file mode 100644 index 0000000000..a617705dbb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-email.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updateEmail( + userId = "<USER_ID>", + email = "email@example.com" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-labels.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-labels.md new file mode 100644 index 0000000000..86f536f728 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-labels.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updateLabels( + userId = "<USER_ID>", + labels = listOf() +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..74602c0f7e --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updateMfaRecoveryCodes( + userId = "<USER_ID>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-mfa.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-mfa.md new file mode 100644 index 0000000000..0148d582b8 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-mfa.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updateMfa( + userId = "<USER_ID>", + mfa = false +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-name.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-name.md new file mode 100644 index 0000000000..fedfce36bd --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-name.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updateName( + userId = "<USER_ID>", + name = "<NAME>" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-password.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-password.md new file mode 100644 index 0000000000..4a0ad576e1 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-password.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updatePassword( + userId = "<USER_ID>", + password = "" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-phone-verification.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-phone-verification.md new file mode 100644 index 0000000000..6520ef4c95 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-phone-verification.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updatePhoneVerification( + userId = "<USER_ID>", + phoneVerification = false +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-phone.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-phone.md new file mode 100644 index 0000000000..7261f95db5 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-phone.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updatePhone( + userId = "<USER_ID>", + number = "+12065550100" +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-prefs.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-prefs.md new file mode 100644 index 0000000000..451f4ff4c6 --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-prefs.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updatePrefs( + userId = "<USER_ID>", + prefs = mapOf( "a" to "b" ) +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-status.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-status.md new file mode 100644 index 0000000000..a69ae30dbc --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-status.md @@ -0,0 +1,15 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updateStatus( + userId = "<USER_ID>", + status = false +) diff --git a/docs/examples/1.7.x/server-kotlin/kotlin/users/update-target.md b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-target.md new file mode 100644 index 0000000000..a18fc63bcb --- /dev/null +++ b/docs/examples/1.7.x/server-kotlin/kotlin/users/update-target.md @@ -0,0 +1,18 @@ +import io.appwrite.Client +import io.appwrite.coroutines.CoroutineCallback +import io.appwrite.services.Users + +val client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +val users = Users(client) + +val response = users.updateTarget( + userId = "<USER_ID>", + targetId = "<TARGET_ID>", + identifier = "<IDENTIFIER>", // optional + providerId = "<PROVIDER_ID>", // optional + name = "<NAME>" // optional +) diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..d8590b03cb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-anonymous-session.md @@ -0,0 +1,9 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.createAnonymousSession(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..6c940f5435 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-email-password-session.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.createEmailPasswordSession( + 'email@example.com', // email + 'password' // password +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-email-token.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-email-token.md new file mode 100644 index 0000000000..b6be71d45c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-email-token.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.createEmailToken( + '<USER_ID>', // userId + 'email@example.com', // email + false // phrase (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..2273646635 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-j-w-t.md @@ -0,0 +1,9 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.createJWT(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..6dbdc3d9fb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.createMagicURLToken( + '<USER_ID>', // userId + 'email@example.com', // email + 'https://example.com', // url (optional) + false // phrase (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..e52658b533 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-mfa-authenticator.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createMfaAuthenticator( + sdk.AuthenticatorType.Totp // type +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..79d5e89eed --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-mfa-challenge.md @@ -0,0 +1,11 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.createMfaChallenge( + sdk.AuthenticationFactor.Email // factor +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..42b3c8c6f5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..adae095105 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-o-auth2token.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.createOAuth2Token( + sdk.OAuthProvider.Amazon, // provider + 'https://example.com', // success (optional) + 'https://example.com', // failure (optional) + [] // scopes (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-phone-token.md new file mode 100644 index 0000000000..aca0bd2d8a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-phone-token.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.createPhoneToken( + '<USER_ID>', // userId + '+12065550100' // phone +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..f7c87f0675 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-phone-verification.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createPhoneVerification(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-recovery.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-recovery.md new file mode 100644 index 0000000000..660942affb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-recovery.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createRecovery( + 'email@example.com', // email + 'https://example.com' // url +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-session.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-session.md new file mode 100644 index 0000000000..8c6b910089 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-session.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.createSession( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create-verification.md b/docs/examples/1.7.x/server-nodejs/examples/account/create-verification.md new file mode 100644 index 0000000000..1f1db27e8a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create-verification.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.createVerification( + 'https://example.com' // url +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/create.md b/docs/examples/1.7.x/server-nodejs/examples/account/create.md new file mode 100644 index 0000000000..85e3d2fcca --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/create.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.create( + '<USER_ID>', // userId + 'email@example.com', // email + '', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/delete-identity.md b/docs/examples/1.7.x/server-nodejs/examples/account/delete-identity.md new file mode 100644 index 0000000000..0424ab247e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/delete-identity.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteIdentity( + '<IDENTITY_ID>' // identityId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-nodejs/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..5979c3a6d7 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteMfaAuthenticator( + sdk.AuthenticatorType.Totp // type +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/delete-session.md b/docs/examples/1.7.x/server-nodejs/examples/account/delete-session.md new file mode 100644 index 0000000000..4276ccad24 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/delete-session.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteSession( + '<SESSION_ID>' // sessionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-nodejs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..884c0e0ebc --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/delete-sessions.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.deleteSessions(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-nodejs/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..27f902424e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.getMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/get-prefs.md b/docs/examples/1.7.x/server-nodejs/examples/account/get-prefs.md new file mode 100644 index 0000000000..d0d7d31aaf --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/get-prefs.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.getPrefs(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/get-session.md b/docs/examples/1.7.x/server-nodejs/examples/account/get-session.md new file mode 100644 index 0000000000..63b6f0893a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/get-session.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.getSession( + '<SESSION_ID>' // sessionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/get.md b/docs/examples/1.7.x/server-nodejs/examples/account/get.md new file mode 100644 index 0000000000..6ebb605ae8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/get.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.get(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/list-identities.md b/docs/examples/1.7.x/server-nodejs/examples/account/list-identities.md new file mode 100644 index 0000000000..c49894c8c0 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/list-identities.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listIdentities( + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/list-logs.md b/docs/examples/1.7.x/server-nodejs/examples/account/list-logs.md new file mode 100644 index 0000000000..4260a72e30 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/list-logs.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listLogs( + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-nodejs/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..a993e31aa8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/list-mfa-factors.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listMfaFactors(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/list-sessions.md b/docs/examples/1.7.x/server-nodejs/examples/account/list-sessions.md new file mode 100644 index 0000000000..33fb527415 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/list-sessions.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.listSessions(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-email.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-email.md new file mode 100644 index 0000000000..6111f0e52a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-email.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateEmail( + 'email@example.com', // email + 'password' // password +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..58629cda3b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-m-f-a.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateMFA( + false // mfa +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..3e059d88d9 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.updateMagicURLSession( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..7b24dc8712 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-mfa-authenticator.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateMfaAuthenticator( + sdk.AuthenticatorType.Totp, // type + '<OTP>' // otp +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..4d30999129 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-mfa-challenge.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateMfaChallenge( + '<CHALLENGE_ID>', // challengeId + '<OTP>' // otp +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..9db82175c9 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-name.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-name.md new file mode 100644 index 0000000000..f47d215288 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-name.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateName( + '<NAME>' // name +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-password.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-password.md new file mode 100644 index 0000000000..aa9d67aede --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-password.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updatePassword( + '', // password + 'password' // oldPassword (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-phone-session.md new file mode 100644 index 0000000000..c208714a37 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-phone-session.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>'); // Your project ID + +const account = new sdk.Account(client); + +const result = await account.updatePhoneSession( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..116d171c92 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-phone-verification.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updatePhoneVerification( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-phone.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-phone.md new file mode 100644 index 0000000000..c6c02fde9a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-phone.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updatePhone( + '+12065550100', // phone + 'password' // password +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-prefs.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-prefs.md new file mode 100644 index 0000000000..ee8b042693 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-prefs.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updatePrefs( + {} // prefs +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-recovery.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-recovery.md new file mode 100644 index 0000000000..bd4a87c3a9 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-recovery.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateRecovery( + '<USER_ID>', // userId + '<SECRET>', // secret + '' // password +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-session.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-session.md new file mode 100644 index 0000000000..be80c85750 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-session.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateSession( + '<SESSION_ID>' // sessionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-status.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-status.md new file mode 100644 index 0000000000..1b70af5378 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-status.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateStatus(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/account/update-verification.md b/docs/examples/1.7.x/server-nodejs/examples/account/update-verification.md new file mode 100644 index 0000000000..0abb562a95 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/account/update-verification.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const account = new sdk.Account(client); + +const result = await account.updateVerification( + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..1cc825d917 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-browser.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getBrowser( + sdk.Browser.AvantBrowser, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..7d62a96033 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-credit-card.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getCreditCard( + sdk.CreditCard.AmericanExpress, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..6056354e9e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-favicon.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getFavicon( + 'https://example.com' // url +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..a62f56dd47 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-flag.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getFlag( + sdk.Flag.Afghanistan, // code + 0, // width (optional) + 0, // height (optional) + -1 // quality (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/avatars/get-image.md b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-image.md new file mode 100644 index 0000000000..7dac2423ba --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-image.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getImage( + 'https://example.com', // url + 0, // width (optional) + 0 // height (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..2cd45bfac8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-initials.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getInitials( + '<NAME>', // name (optional) + 0, // width (optional) + 0, // height (optional) + '' // background (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..cfd649ea33 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/avatars/get-q-r.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const avatars = new sdk.Avatars(client); + +const result = await avatars.getQR( + '<TEXT>', // text + 1, // size (optional) + 0, // margin (optional) + false // download (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..b6239698a5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-boolean-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createBooleanAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + false, // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-collection.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-collection.md new file mode 100644 index 0000000000..fc5c798385 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-collection.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createCollection( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<NAME>', // name + ["read("any")"], // permissions (optional) + false, // documentSecurity (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..4c7328ce4b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-datetime-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createDatetimeAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-document.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-document.md new file mode 100644 index 0000000000..44cfc3c199 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-document.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setSession('') // The user session to authenticate with + .setKey('<YOUR_API_KEY>') // Your secret API key + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +const databases = new sdk.Databases(client); + +const result = await databases.createDocument( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<DOCUMENT_ID>', // documentId + {}, // data + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-documents.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-documents.md new file mode 100644 index 0000000000..1b2088221b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-documents.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // documents +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..47b27508cd --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-email-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createEmailAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + 'email@example.com', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..61c1d77f2c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-enum-attribute.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createEnumAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + [], // elements + false, // required + '<DEFAULT>', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..3e605001e6 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-float-attribute.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createFloatAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + null, // min (optional) + null, // max (optional) + null, // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-index.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-index.md new file mode 100644 index 0000000000..ed03322cbd --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-index.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createIndex( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + sdk.IndexType.Key, // type + [], // attributes + [], // orders (optional) + [] // lengths (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..ce62624001 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-integer-attribute.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createIntegerAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + null, // min (optional) + null, // max (optional) + null, // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..e3bbffe227 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-ip-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createIpAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..bb77bc00c3 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-relationship-attribute.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createRelationshipAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<RELATED_COLLECTION_ID>', // relatedCollectionId + sdk.RelationshipType.OneToOne, // type + false, // twoWay (optional) + '', // key (optional) + '', // twoWayKey (optional) + sdk.RelationMutate.Cascade // onDelete (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..94793e86db --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-string-attribute.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createStringAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + 1, // size + false, // required + '<DEFAULT>', // default (optional) + false, // array (optional) + false // encrypt (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..6b6b1daaa0 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create-url-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.createUrlAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + 'https://example.com', // default (optional) + false // array (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/create.md b/docs/examples/1.7.x/server-nodejs/examples/databases/create.md new file mode 100644 index 0000000000..c1fd4eca43 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/create.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.create( + '<DATABASE_ID>', // databaseId + '<NAME>', // name + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..8291fc095e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-attribute.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.deleteAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '' // key +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-collection.md new file mode 100644 index 0000000000..9551c558fb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-collection.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.deleteCollection( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>' // collectionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/delete-document.md b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-document.md new file mode 100644 index 0000000000..526f00eb3a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-document.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.deleteDocument( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<DOCUMENT_ID>' // documentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-documents.md new file mode 100644 index 0000000000..01814e5052 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-documents.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.deleteDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/delete-index.md b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-index.md new file mode 100644 index 0000000000..90353ea44e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/delete-index.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.deleteIndex( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '' // key +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/delete.md b/docs/examples/1.7.x/server-nodejs/examples/databases/delete.md new file mode 100644 index 0000000000..65179d2b2a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/delete.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.delete( + '<DATABASE_ID>' // databaseId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/get-attribute.md new file mode 100644 index 0000000000..8757265edb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/get-attribute.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.getAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '' // key +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/get-collection.md b/docs/examples/1.7.x/server-nodejs/examples/databases/get-collection.md new file mode 100644 index 0000000000..79c5674985 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/get-collection.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.getCollection( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>' // collectionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/get-document.md b/docs/examples/1.7.x/server-nodejs/examples/databases/get-document.md new file mode 100644 index 0000000000..eee515bf36 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/get-document.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.getDocument( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<DOCUMENT_ID>', // documentId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/get-index.md b/docs/examples/1.7.x/server-nodejs/examples/databases/get-index.md new file mode 100644 index 0000000000..a4b3a45eb8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/get-index.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.getIndex( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '' // key +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/get.md b/docs/examples/1.7.x/server-nodejs/examples/databases/get.md new file mode 100644 index 0000000000..a8e8084673 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/get.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.get( + '<DATABASE_ID>' // databaseId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-nodejs/examples/databases/list-attributes.md new file mode 100644 index 0000000000..e7b48fb9f0 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/list-attributes.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.listAttributes( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/list-collections.md b/docs/examples/1.7.x/server-nodejs/examples/databases/list-collections.md new file mode 100644 index 0000000000..bc31eadf9b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/list-collections.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.listCollections( + '<DATABASE_ID>', // databaseId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/list-documents.md b/docs/examples/1.7.x/server-nodejs/examples/databases/list-documents.md new file mode 100644 index 0000000000..d2514850d8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/list-documents.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.listDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-nodejs/examples/databases/list-indexes.md new file mode 100644 index 0000000000..86c6c26ec6 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/list-indexes.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.listIndexes( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/list.md b/docs/examples/1.7.x/server-nodejs/examples/databases/list.md new file mode 100644 index 0000000000..06fe6a8462 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/list.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..d0d551c3fd --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-boolean-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateBooleanAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + false, // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-collection.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-collection.md new file mode 100644 index 0000000000..2618fc735e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-collection.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateCollection( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<NAME>', // name + ["read("any")"], // permissions (optional) + false, // documentSecurity (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..d2378f93ca --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-datetime-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateDatetimeAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-document.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-document.md new file mode 100644 index 0000000000..96468037e7 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-document.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const databases = new sdk.Databases(client); + +const result = await databases.updateDocument( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '<DOCUMENT_ID>', // documentId + {}, // data (optional) + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-documents.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-documents.md new file mode 100644 index 0000000000..62b2271bae --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-documents.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + {}, // data (optional) + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..8b7afbebb5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-email-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateEmailAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + 'email@example.com', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..f328132519 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-enum-attribute.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateEnumAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + [], // elements + false, // required + '<DEFAULT>', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..abb93c28fa --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-float-attribute.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateFloatAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + null, // default + null, // min (optional) + null, // max (optional) + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..e126f31fd8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-integer-attribute.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateIntegerAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + null, // default + null, // min (optional) + null, // max (optional) + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..1c8ac79dd8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-ip-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateIpAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..1a7a26cc92 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-relationship-attribute.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateRelationshipAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + sdk.RelationMutate.Cascade, // onDelete (optional) + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..0e0656ef10 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-string-attribute.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateStringAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + '<DEFAULT>', // default + 1, // size (optional) + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..4a2aca0fe9 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update-url-attribute.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.updateUrlAttribute( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + '', // key + false, // required + 'https://example.com', // default + '' // newKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/update.md b/docs/examples/1.7.x/server-nodejs/examples/databases/update.md new file mode 100644 index 0000000000..9c69bfd2ce --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/update.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.update( + '<DATABASE_ID>', // databaseId + '<NAME>', // name + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-nodejs/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..5b4795627d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/databases/upsert-documents.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const databases = new sdk.Databases(client); + +const result = await databases.upsertDocuments( + '<DATABASE_ID>', // databaseId + '<COLLECTION_ID>', // collectionId + [] // documents (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/functions/create-deployment.md new file mode 100644 index 0000000000..5ede954907 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/create-deployment.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); +const fs = require('fs'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createDeployment( + '<FUNCTION_ID>', // functionId + InputFile.fromPath('/path/to/file', 'filename'), // code + false, // activate + '<ENTRYPOINT>', // entrypoint (optional) + '<COMMANDS>' // commands (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..33f77ffd39 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createDuplicateDeployment( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>', // deploymentId + '<BUILD_ID>' // buildId (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/create-execution.md b/docs/examples/1.7.x/server-nodejs/examples/functions/create-execution.md new file mode 100644 index 0000000000..3c89030ca6 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/create-execution.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const functions = new sdk.Functions(client); + +const result = await functions.createExecution( + '<FUNCTION_ID>', // functionId + '<BODY>', // body (optional) + false, // async (optional) + '<PATH>', // path (optional) + sdk.ExecutionMethod.GET, // method (optional) + {}, // headers (optional) + '' // scheduledAt (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..eef7148f94 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/create-template-deployment.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createTemplateDeployment( + '<FUNCTION_ID>', // functionId + '<REPOSITORY>', // repository + '<OWNER>', // owner + '<ROOT_DIRECTORY>', // rootDirectory + '<VERSION>', // version + false // activate (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/create-variable.md b/docs/examples/1.7.x/server-nodejs/examples/functions/create-variable.md new file mode 100644 index 0000000000..5e75d19bf4 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/create-variable.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createVariable( + '<FUNCTION_ID>', // functionId + '<KEY>', // key + '<VALUE>', // value + false // secret (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..ba1067f579 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/create-vcs-deployment.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.createVcsDeployment( + '<FUNCTION_ID>', // functionId + sdk.VCSDeploymentType.Branch, // type + '<REFERENCE>', // reference + false // activate (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/create.md b/docs/examples/1.7.x/server-nodejs/examples/functions/create.md new file mode 100644 index 0000000000..646e2e5b4d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/create.md @@ -0,0 +1,29 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.create( + '<FUNCTION_ID>', // functionId + '<NAME>', // name + sdk..Node145, // runtime + ["any"], // execute (optional) + [], // events (optional) + '', // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + '<ENTRYPOINT>', // entrypoint (optional) + '<COMMANDS>', // commands (optional) + [], // scopes (optional) + '<INSTALLATION_ID>', // installationId (optional) + '<PROVIDER_REPOSITORY_ID>', // providerRepositoryId (optional) + '<PROVIDER_BRANCH>', // providerBranch (optional) + false, // providerSilentMode (optional) + '<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional) + '' // specification (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..f6768ec739 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/delete-deployment.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.deleteDeployment( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-nodejs/examples/functions/delete-execution.md new file mode 100644 index 0000000000..c3e77a6860 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/delete-execution.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.deleteExecution( + '<FUNCTION_ID>', // functionId + '<EXECUTION_ID>' // executionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-nodejs/examples/functions/delete-variable.md new file mode 100644 index 0000000000..7840b1d562 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/delete-variable.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.deleteVariable( + '<FUNCTION_ID>', // functionId + '<VARIABLE_ID>' // variableId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/delete.md b/docs/examples/1.7.x/server-nodejs/examples/functions/delete.md new file mode 100644 index 0000000000..a2e0a23a2b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/delete.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.delete( + '<FUNCTION_ID>' // functionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-nodejs/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..5ba1035392 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/get-deployment-download.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.getDeploymentDownload( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>', // deploymentId + sdk.DeploymentDownloadType.Source // type (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/functions/get-deployment.md new file mode 100644 index 0000000000..6a55534af4 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/get-deployment.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.getDeployment( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/get-execution.md b/docs/examples/1.7.x/server-nodejs/examples/functions/get-execution.md new file mode 100644 index 0000000000..b9fed55799 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/get-execution.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const functions = new sdk.Functions(client); + +const result = await functions.getExecution( + '<FUNCTION_ID>', // functionId + '<EXECUTION_ID>' // executionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/get-variable.md b/docs/examples/1.7.x/server-nodejs/examples/functions/get-variable.md new file mode 100644 index 0000000000..3b6135f7dc --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/get-variable.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.getVariable( + '<FUNCTION_ID>', // functionId + '<VARIABLE_ID>' // variableId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/get.md b/docs/examples/1.7.x/server-nodejs/examples/functions/get.md new file mode 100644 index 0000000000..b88609252e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/get.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.get( + '<FUNCTION_ID>' // functionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-nodejs/examples/functions/list-deployments.md new file mode 100644 index 0000000000..731d1c46cf --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/list-deployments.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.listDeployments( + '<FUNCTION_ID>', // functionId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/list-executions.md b/docs/examples/1.7.x/server-nodejs/examples/functions/list-executions.md new file mode 100644 index 0000000000..24d3e54ef3 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/list-executions.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const functions = new sdk.Functions(client); + +const result = await functions.listExecutions( + '<FUNCTION_ID>', // functionId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-nodejs/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..a0f83b2273 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/list-runtimes.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.listRuntimes(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-nodejs/examples/functions/list-specifications.md new file mode 100644 index 0000000000..f918c44053 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/list-specifications.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.listSpecifications(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/list-variables.md b/docs/examples/1.7.x/server-nodejs/examples/functions/list-variables.md new file mode 100644 index 0000000000..4220918fa6 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/list-variables.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.listVariables( + '<FUNCTION_ID>' // functionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/list.md b/docs/examples/1.7.x/server-nodejs/examples/functions/list.md new file mode 100644 index 0000000000..af5082c25e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/list.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-nodejs/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..e7ce4a815c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/update-deployment-status.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.updateDeploymentStatus( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..feef831e5c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/update-function-deployment.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.updateFunctionDeployment( + '<FUNCTION_ID>', // functionId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/update-variable.md b/docs/examples/1.7.x/server-nodejs/examples/functions/update-variable.md new file mode 100644 index 0000000000..d9a7ac7e0b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/update-variable.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.updateVariable( + '<FUNCTION_ID>', // functionId + '<VARIABLE_ID>', // variableId + '<KEY>', // key + '<VALUE>', // value (optional) + false // secret (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/functions/update.md b/docs/examples/1.7.x/server-nodejs/examples/functions/update.md new file mode 100644 index 0000000000..b6de177cff --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/functions/update.md @@ -0,0 +1,29 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const functions = new sdk.Functions(client); + +const result = await functions.update( + '<FUNCTION_ID>', // functionId + '<NAME>', // name + sdk..Node145, // runtime (optional) + ["any"], // execute (optional) + [], // events (optional) + '', // schedule (optional) + 1, // timeout (optional) + false, // enabled (optional) + false, // logging (optional) + '<ENTRYPOINT>', // entrypoint (optional) + '<COMMANDS>', // commands (optional) + [], // scopes (optional) + '<INSTALLATION_ID>', // installationId (optional) + '<PROVIDER_REPOSITORY_ID>', // providerRepositoryId (optional) + '<PROVIDER_BRANCH>', // providerBranch (optional) + false, // providerSilentMode (optional) + '<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional) + '' // specification (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/graphql/mutation.md b/docs/examples/1.7.x/server-nodejs/examples/graphql/mutation.md new file mode 100644 index 0000000000..8031a5285a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/graphql/mutation.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const graphql = new sdk.Graphql(client); + +const result = await graphql.mutation( + {} // query +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/graphql/query.md b/docs/examples/1.7.x/server-nodejs/examples/graphql/query.md new file mode 100644 index 0000000000..15456754cb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/graphql/query.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const graphql = new sdk.Graphql(client); + +const result = await graphql.query( + {} // query +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-antivirus.md new file mode 100644 index 0000000000..9efa2d803c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-antivirus.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getAntivirus(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-cache.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-cache.md new file mode 100644 index 0000000000..014340123d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-cache.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getCache(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-certificate.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-certificate.md new file mode 100644 index 0000000000..ec9129344c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-certificate.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getCertificate( + '' // domain (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-d-b.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-d-b.md new file mode 100644 index 0000000000..0d86d08d1c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-d-b.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getDB(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..d88b7f2bfd --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-failed-jobs.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getFailedJobs( + sdk..V1Database, // name + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..b5b97374d5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-pub-sub.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getPubSub(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..929f9769fb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-builds.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueBuilds( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..33e71ecac6 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-certificates.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueCertificates( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..ca409c1ba5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-databases.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueDatabases( + '<NAME>', // name (optional) + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..9f2d6f8cf5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-deletes.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueDeletes( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..0392db1079 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-functions.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueFunctions( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..a71ff13397 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-logs.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueLogs( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..8c45c1a194 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-mails.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueMails( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..46160a0e88 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-messaging.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueMessaging( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..5f8d262e30 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-migrations.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueMigrations( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..1b16e6d5b8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-stats-resources.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueStatsResources( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..2a20620cd2 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-usage.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueUsage( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..acc2098365 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-queue-webhooks.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getQueueWebhooks( + null // threshold (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..0ea8e0e27f --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-storage-local.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getStorageLocal(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-storage.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-storage.md new file mode 100644 index 0000000000..d199800559 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-storage.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getStorage(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get-time.md b/docs/examples/1.7.x/server-nodejs/examples/health/get-time.md new file mode 100644 index 0000000000..cd4f42e33e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get-time.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.getTime(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/health/get.md b/docs/examples/1.7.x/server-nodejs/examples/health/get.md new file mode 100644 index 0000000000..e10c4e28f5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/health/get.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const health = new sdk.Health(client); + +const result = await health.get(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/locale/get.md b/docs/examples/1.7.x/server-nodejs/examples/locale/get.md new file mode 100644 index 0000000000..d57eb8f241 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/locale/get.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.get(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/locale/list-codes.md b/docs/examples/1.7.x/server-nodejs/examples/locale/list-codes.md new file mode 100644 index 0000000000..280d14ae6e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/locale/list-codes.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCodes(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/locale/list-continents.md b/docs/examples/1.7.x/server-nodejs/examples/locale/list-continents.md new file mode 100644 index 0000000000..d04d6d6a47 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/locale/list-continents.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listContinents(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-nodejs/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..6e41074b61 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/locale/list-countries-e-u.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCountriesEU(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-nodejs/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..9621e9cbfc --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/locale/list-countries-phones.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCountriesPhones(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/locale/list-countries.md b/docs/examples/1.7.x/server-nodejs/examples/locale/list-countries.md new file mode 100644 index 0000000000..a81b1581f3 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/locale/list-countries.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCountries(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-nodejs/examples/locale/list-currencies.md new file mode 100644 index 0000000000..a585fd33ae --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/locale/list-currencies.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listCurrencies(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/locale/list-languages.md b/docs/examples/1.7.x/server-nodejs/examples/locale/list-languages.md new file mode 100644 index 0000000000..aea0fadf89 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/locale/list-languages.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const locale = new sdk.Locale(client); + +const result = await locale.listLanguages(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..a28309023a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-apns-provider.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createApnsProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<AUTH_KEY>', // authKey (optional) + '<AUTH_KEY_ID>', // authKeyId (optional) + '<TEAM_ID>', // teamId (optional) + '<BUNDLE_ID>', // bundleId (optional) + false, // sandbox (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-email.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-email.md new file mode 100644 index 0000000000..b4b1f6622a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-email.md @@ -0,0 +1,23 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createEmail( + '<MESSAGE_ID>', // messageId + '<SUBJECT>', // subject + '<CONTENT>', // content + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + [], // cc (optional) + [], // bcc (optional) + [], // attachments (optional) + false, // draft (optional) + false, // html (optional) + '' // scheduledAt (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..a8af6ba12c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-fcm-provider.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createFcmProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + {}, // serviceAccountJSON (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..ee49f64f7c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,21 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createMailgunProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<API_KEY>', // apiKey (optional) + '<DOMAIN>', // domain (optional) + false, // isEuRegion (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + 'email@example.com', // replyToEmail (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..e7075dc3b8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-msg91provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createMsg91Provider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<TEMPLATE_ID>', // templateId (optional) + '<SENDER_ID>', // senderId (optional) + '<AUTH_KEY>', // authKey (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-push.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-push.md new file mode 100644 index 0000000000..bd89f761fb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-push.md @@ -0,0 +1,30 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createPush( + '<MESSAGE_ID>', // messageId + '<TITLE>', // title (optional) + '<BODY>', // body (optional) + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + {}, // data (optional) + '<ACTION>', // action (optional) + '[ID1:ID2]', // image (optional) + '<ICON>', // icon (optional) + '<SOUND>', // sound (optional) + '<COLOR>', // color (optional) + '<TAG>', // tag (optional) + null, // badge (optional) + false, // draft (optional) + '', // scheduledAt (optional) + false, // contentAvailable (optional) + false, // critical (optional) + sdk.MessagePriority.Normal // priority (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..8cde02e80c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createSendgridProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<API_KEY>', // apiKey (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + 'email@example.com', // replyToEmail (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-sms.md new file mode 100644 index 0000000000..226f47c8d4 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-sms.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createSms( + '<MESSAGE_ID>', // messageId + '<CONTENT>', // content + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + false, // draft (optional) + '' // scheduledAt (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..50a8d202c5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-smtp-provider.md @@ -0,0 +1,25 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createSmtpProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '<HOST>', // host + 1, // port (optional) + '<USERNAME>', // username (optional) + '<PASSWORD>', // password (optional) + sdk.SmtpEncryption.None, // encryption (optional) + false, // autoTLS (optional) + '<MAILER>', // mailer (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + 'email@example.com', // replyToEmail (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..9874d072b8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-subscriber.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createSubscriber( + '<TOPIC_ID>', // topicId + '<SUBSCRIBER_ID>', // subscriberId + '<TARGET_ID>' // targetId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..b877172163 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-telesign-provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createTelesignProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '+12065550100', // from (optional) + '<CUSTOMER_ID>', // customerId (optional) + '<API_KEY>', // apiKey (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..b40d5ee4e7 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createTextmagicProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '+12065550100', // from (optional) + '<USERNAME>', // username (optional) + '<API_KEY>', // apiKey (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-topic.md new file mode 100644 index 0000000000..35c93eadca --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-topic.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createTopic( + '<TOPIC_ID>', // topicId + '<NAME>', // name + ["any"] // subscribe (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..4dcb9a841d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-twilio-provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createTwilioProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '+12065550100', // from (optional) + '<ACCOUNT_SID>', // accountSid (optional) + '<AUTH_TOKEN>', // authToken (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..493cd2b660 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/create-vonage-provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.createVonageProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name + '+12065550100', // from (optional) + '<API_KEY>', // apiKey (optional) + '<API_SECRET>', // apiSecret (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..23b474f787 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/delete-provider.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.deleteProvider( + '<PROVIDER_ID>' // providerId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..1f5e21af93 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/delete-subscriber.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +const messaging = new sdk.Messaging(client); + +const result = await messaging.deleteSubscriber( + '<TOPIC_ID>', // topicId + '<SUBSCRIBER_ID>' // subscriberId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..af39f73491 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/delete-topic.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.deleteTopic( + '<TOPIC_ID>' // topicId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/delete.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/delete.md new file mode 100644 index 0000000000..fd49104a49 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/delete.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.delete( + '<MESSAGE_ID>' // messageId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/get-message.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/get-message.md new file mode 100644 index 0000000000..f83ab51c23 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/get-message.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.getMessage( + '<MESSAGE_ID>' // messageId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/get-provider.md new file mode 100644 index 0000000000..2f52698bfc --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/get-provider.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.getProvider( + '<PROVIDER_ID>' // providerId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..5132f1772a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/get-subscriber.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.getSubscriber( + '<TOPIC_ID>', // topicId + '<SUBSCRIBER_ID>' // subscriberId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/get-topic.md new file mode 100644 index 0000000000..98e38383d4 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/get-topic.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.getTopic( + '<TOPIC_ID>' // topicId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..56e1288af7 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-message-logs.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listMessageLogs( + '<MESSAGE_ID>', // messageId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-messages.md new file mode 100644 index 0000000000..db0785ece8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-messages.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listMessages( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..6cb2a01df4 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-provider-logs.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listProviderLogs( + '<PROVIDER_ID>', // providerId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-providers.md new file mode 100644 index 0000000000..aefb41d15a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-providers.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listProviders( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..8d46a08578 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listSubscriberLogs( + '<SUBSCRIBER_ID>', // subscriberId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..167b48e978 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-subscribers.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listSubscribers( + '<TOPIC_ID>', // topicId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-targets.md new file mode 100644 index 0000000000..971285d87c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-targets.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listTargets( + '<MESSAGE_ID>', // messageId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..39e82954d1 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-topic-logs.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listTopicLogs( + '<TOPIC_ID>', // topicId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-topics.md new file mode 100644 index 0000000000..6fd94bba42 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/list-topics.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.listTopics( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..e782b8c3f7 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-apns-provider.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateApnsProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<AUTH_KEY>', // authKey (optional) + '<AUTH_KEY_ID>', // authKeyId (optional) + '<TEAM_ID>', // teamId (optional) + '<BUNDLE_ID>', // bundleId (optional) + false // sandbox (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-email.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-email.md new file mode 100644 index 0000000000..2ea2941efd --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-email.md @@ -0,0 +1,23 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateEmail( + '<MESSAGE_ID>', // messageId + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + '<SUBJECT>', // subject (optional) + '<CONTENT>', // content (optional) + false, // draft (optional) + false, // html (optional) + [], // cc (optional) + [], // bcc (optional) + '', // scheduledAt (optional) + [] // attachments (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..9184f283d0 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-fcm-provider.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateFcmProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + {} // serviceAccountJSON (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..a1ac18fd60 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,21 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateMailgunProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + '<API_KEY>', // apiKey (optional) + '<DOMAIN>', // domain (optional) + false, // isEuRegion (optional) + false, // enabled (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + '<REPLY_TO_EMAIL>' // replyToEmail (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..c66b91f8c0 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-msg91provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateMsg91Provider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<TEMPLATE_ID>', // templateId (optional) + '<SENDER_ID>', // senderId (optional) + '<AUTH_KEY>' // authKey (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-push.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-push.md new file mode 100644 index 0000000000..db52bee373 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-push.md @@ -0,0 +1,30 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updatePush( + '<MESSAGE_ID>', // messageId + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + '<TITLE>', // title (optional) + '<BODY>', // body (optional) + {}, // data (optional) + '<ACTION>', // action (optional) + '[ID1:ID2]', // image (optional) + '<ICON>', // icon (optional) + '<SOUND>', // sound (optional) + '<COLOR>', // color (optional) + '<TAG>', // tag (optional) + null, // badge (optional) + false, // draft (optional) + '', // scheduledAt (optional) + false, // contentAvailable (optional) + false, // critical (optional) + sdk.MessagePriority.Normal // priority (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..8420a2fac2 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,19 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateSendgridProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<API_KEY>', // apiKey (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + '<REPLY_TO_EMAIL>' // replyToEmail (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-sms.md new file mode 100644 index 0000000000..98ee6feb23 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-sms.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateSms( + '<MESSAGE_ID>', // messageId + [], // topics (optional) + [], // users (optional) + [], // targets (optional) + '<CONTENT>', // content (optional) + false, // draft (optional) + '' // scheduledAt (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..0bbe4cd2cb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-smtp-provider.md @@ -0,0 +1,25 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateSmtpProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + '<HOST>', // host (optional) + 1, // port (optional) + '<USERNAME>', // username (optional) + '<PASSWORD>', // password (optional) + sdk.SmtpEncryption.None, // encryption (optional) + false, // autoTLS (optional) + '<MAILER>', // mailer (optional) + '<FROM_NAME>', // fromName (optional) + 'email@example.com', // fromEmail (optional) + '<REPLY_TO_NAME>', // replyToName (optional) + '<REPLY_TO_EMAIL>', // replyToEmail (optional) + false // enabled (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..2f23a3b11f --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-telesign-provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateTelesignProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<CUSTOMER_ID>', // customerId (optional) + '<API_KEY>', // apiKey (optional) + '<FROM>' // from (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..6fb6c82e8f --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateTextmagicProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<USERNAME>', // username (optional) + '<API_KEY>', // apiKey (optional) + '<FROM>' // from (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-topic.md new file mode 100644 index 0000000000..6330970077 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-topic.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateTopic( + '<TOPIC_ID>', // topicId + '<NAME>', // name (optional) + ["any"] // subscribe (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..e4667f56ae --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-twilio-provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateTwilioProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<ACCOUNT_SID>', // accountSid (optional) + '<AUTH_TOKEN>', // authToken (optional) + '<FROM>' // from (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..b95398b4ea --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/messaging/update-vonage-provider.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const messaging = new sdk.Messaging(client); + +const result = await messaging.updateVonageProvider( + '<PROVIDER_ID>', // providerId + '<NAME>', // name (optional) + false, // enabled (optional) + '<API_KEY>', // apiKey (optional) + '<API_SECRET>', // apiSecret (optional) + '<FROM>' // from (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/sites/create-deployment.md new file mode 100644 index 0000000000..010da729ed --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/create-deployment.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); +const fs = require('fs'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createDeployment( + '<SITE_ID>', // siteId + InputFile.fromPath('/path/to/file', 'filename'), // code + false, // activate + '<INSTALL_COMMAND>', // installCommand (optional) + '<BUILD_COMMAND>', // buildCommand (optional) + '<OUTPUT_DIRECTORY>' // outputDirectory (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..3ce35ff559 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createDuplicateDeployment( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..aebc2b8f4d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/create-template-deployment.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createTemplateDeployment( + '<SITE_ID>', // siteId + '<REPOSITORY>', // repository + '<OWNER>', // owner + '<ROOT_DIRECTORY>', // rootDirectory + '<VERSION>', // version + false // activate (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/create-variable.md b/docs/examples/1.7.x/server-nodejs/examples/sites/create-variable.md new file mode 100644 index 0000000000..59a51eea76 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/create-variable.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createVariable( + '<SITE_ID>', // siteId + '<KEY>', // key + '<VALUE>', // value + false // secret (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..4bd849777b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/create-vcs-deployment.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.createVcsDeployment( + '<SITE_ID>', // siteId + sdk.VCSDeploymentType.Branch, // type + '<REFERENCE>', // reference + false // activate (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/create.md b/docs/examples/1.7.x/server-nodejs/examples/sites/create.md new file mode 100644 index 0000000000..ad680592c2 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/create.md @@ -0,0 +1,29 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.create( + '<SITE_ID>', // siteId + '<NAME>', // name + sdk..Analog, // framework + sdk..Node145, // buildRuntime + false, // enabled (optional) + false, // logging (optional) + 1, // timeout (optional) + '<INSTALL_COMMAND>', // installCommand (optional) + '<BUILD_COMMAND>', // buildCommand (optional) + '<OUTPUT_DIRECTORY>', // outputDirectory (optional) + sdk..Static, // adapter (optional) + '<INSTALLATION_ID>', // installationId (optional) + '<FALLBACK_FILE>', // fallbackFile (optional) + '<PROVIDER_REPOSITORY_ID>', // providerRepositoryId (optional) + '<PROVIDER_BRANCH>', // providerBranch (optional) + false, // providerSilentMode (optional) + '<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional) + '' // specification (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..c04a5c38d7 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/delete-deployment.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.deleteDeployment( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/delete-log.md b/docs/examples/1.7.x/server-nodejs/examples/sites/delete-log.md new file mode 100644 index 0000000000..88e58a5f62 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/delete-log.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.deleteLog( + '<SITE_ID>', // siteId + '<LOG_ID>' // logId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-nodejs/examples/sites/delete-variable.md new file mode 100644 index 0000000000..abc7e3ac47 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/delete-variable.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.deleteVariable( + '<SITE_ID>', // siteId + '<VARIABLE_ID>' // variableId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/delete.md b/docs/examples/1.7.x/server-nodejs/examples/sites/delete.md new file mode 100644 index 0000000000..87fd7d23be --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/delete.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.delete( + '<SITE_ID>' // siteId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-nodejs/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..414d50d4f8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/get-deployment-download.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.getDeploymentDownload( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>', // deploymentId + sdk.DeploymentDownloadType.Source // type (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/sites/get-deployment.md new file mode 100644 index 0000000000..3f06b1ab07 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/get-deployment.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.getDeployment( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/get-log.md b/docs/examples/1.7.x/server-nodejs/examples/sites/get-log.md new file mode 100644 index 0000000000..4318882c95 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/get-log.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.getLog( + '<SITE_ID>', // siteId + '<LOG_ID>' // logId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/get-variable.md b/docs/examples/1.7.x/server-nodejs/examples/sites/get-variable.md new file mode 100644 index 0000000000..287336fd45 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/get-variable.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.getVariable( + '<SITE_ID>', // siteId + '<VARIABLE_ID>' // variableId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/get.md b/docs/examples/1.7.x/server-nodejs/examples/sites/get.md new file mode 100644 index 0000000000..d382efa2c8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/get.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.get( + '<SITE_ID>' // siteId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-nodejs/examples/sites/list-deployments.md new file mode 100644 index 0000000000..dce44ed134 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/list-deployments.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listDeployments( + '<SITE_ID>', // siteId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-nodejs/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..0376e4b552 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/list-frameworks.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listFrameworks(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/list-logs.md b/docs/examples/1.7.x/server-nodejs/examples/sites/list-logs.md new file mode 100644 index 0000000000..faaf3d3542 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/list-logs.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listLogs( + '<SITE_ID>', // siteId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-nodejs/examples/sites/list-specifications.md new file mode 100644 index 0000000000..24ec74c4aa --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/list-specifications.md @@ -0,0 +1,10 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listSpecifications(); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/list-variables.md b/docs/examples/1.7.x/server-nodejs/examples/sites/list-variables.md new file mode 100644 index 0000000000..948e977abc --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/list-variables.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.listVariables( + '<SITE_ID>' // siteId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/list.md b/docs/examples/1.7.x/server-nodejs/examples/sites/list.md new file mode 100644 index 0000000000..184f4f3fc4 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/list.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-nodejs/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..7756424523 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/update-deployment-status.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.updateDeploymentStatus( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-nodejs/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..bfbc0f3514 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/update-site-deployment.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.updateSiteDeployment( + '<SITE_ID>', // siteId + '<DEPLOYMENT_ID>' // deploymentId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/update-variable.md b/docs/examples/1.7.x/server-nodejs/examples/sites/update-variable.md new file mode 100644 index 0000000000..c790ca10eb --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/update-variable.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.updateVariable( + '<SITE_ID>', // siteId + '<VARIABLE_ID>', // variableId + '<KEY>', // key + '<VALUE>', // value (optional) + false // secret (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/sites/update.md b/docs/examples/1.7.x/server-nodejs/examples/sites/update.md new file mode 100644 index 0000000000..e801aed187 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/sites/update.md @@ -0,0 +1,29 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const sites = new sdk.Sites(client); + +const result = await sites.update( + '<SITE_ID>', // siteId + '<NAME>', // name + sdk..Analog, // framework + false, // enabled (optional) + false, // logging (optional) + 1, // timeout (optional) + '<INSTALL_COMMAND>', // installCommand (optional) + '<BUILD_COMMAND>', // buildCommand (optional) + '<OUTPUT_DIRECTORY>', // outputDirectory (optional) + sdk..Node145, // buildRuntime (optional) + sdk..Static, // adapter (optional) + '<FALLBACK_FILE>', // fallbackFile (optional) + '<INSTALLATION_ID>', // installationId (optional) + '<PROVIDER_REPOSITORY_ID>', // providerRepositoryId (optional) + '<PROVIDER_BRANCH>', // providerBranch (optional) + false, // providerSilentMode (optional) + '<PROVIDER_ROOT_DIRECTORY>', // providerRootDirectory (optional) + '' // specification (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-nodejs/examples/storage/create-bucket.md new file mode 100644 index 0000000000..fc318f169d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/create-bucket.md @@ -0,0 +1,21 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.createBucket( + '<BUCKET_ID>', // bucketId + '<NAME>', // name + ["read("any")"], // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + [], // allowedFileExtensions (optional) + sdk..None, // compression (optional) + false, // encryption (optional) + false // antivirus (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/create-file.md b/docs/examples/1.7.x/server-nodejs/examples/storage/create-file.md new file mode 100644 index 0000000000..b84d9ac653 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/create-file.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); +const fs = require('fs'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.createFile( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + InputFile.fromPath('/path/to/file', 'filename'), // file + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-nodejs/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..c2067efda2 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/delete-bucket.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.deleteBucket( + '<BUCKET_ID>' // bucketId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/delete-file.md b/docs/examples/1.7.x/server-nodejs/examples/storage/delete-file.md new file mode 100644 index 0000000000..4d2e7128cd --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/delete-file.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.deleteFile( + '<BUCKET_ID>', // bucketId + '<FILE_ID>' // fileId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-nodejs/examples/storage/get-bucket.md new file mode 100644 index 0000000000..c8a0b1c55d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/get-bucket.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.getBucket( + '<BUCKET_ID>' // bucketId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-nodejs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..6935bede48 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/get-file-download.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.getFileDownload( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + '<TOKEN>' // token (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-nodejs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..fe24419c52 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/get-file-preview.md @@ -0,0 +1,25 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.getFilePreview( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + 0, // width (optional) + 0, // height (optional) + sdk.ImageGravity.Center, // gravity (optional) + -1, // quality (optional) + 0, // borderWidth (optional) + '', // borderColor (optional) + 0, // borderRadius (optional) + 0, // opacity (optional) + -360, // rotation (optional) + '', // background (optional) + sdk.ImageFormat.Jpg, // output (optional) + '<TOKEN>' // token (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-nodejs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..9493cfb0a3 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/get-file-view.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.getFileView( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + '<TOKEN>' // token (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/get-file.md b/docs/examples/1.7.x/server-nodejs/examples/storage/get-file.md new file mode 100644 index 0000000000..1a6b500013 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/get-file.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.getFile( + '<BUCKET_ID>', // bucketId + '<FILE_ID>' // fileId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-nodejs/examples/storage/list-buckets.md new file mode 100644 index 0000000000..3c4d4b14f7 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/list-buckets.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.listBuckets( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/list-files.md b/docs/examples/1.7.x/server-nodejs/examples/storage/list-files.md new file mode 100644 index 0000000000..fb595efc05 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/list-files.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.listFiles( + '<BUCKET_ID>', // bucketId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-nodejs/examples/storage/update-bucket.md new file mode 100644 index 0000000000..24e4872d8d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/update-bucket.md @@ -0,0 +1,21 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const storage = new sdk.Storage(client); + +const result = await storage.updateBucket( + '<BUCKET_ID>', // bucketId + '<NAME>', // name + ["read("any")"], // permissions (optional) + false, // fileSecurity (optional) + false, // enabled (optional) + 1, // maximumFileSize (optional) + [], // allowedFileExtensions (optional) + sdk..None, // compression (optional) + false, // encryption (optional) + false // antivirus (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/storage/update-file.md b/docs/examples/1.7.x/server-nodejs/examples/storage/update-file.md new file mode 100644 index 0000000000..7eed687cf5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/storage/update-file.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const storage = new sdk.Storage(client); + +const result = await storage.updateFile( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + '<NAME>', // name (optional) + ["read("any")"] // permissions (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/create-membership.md b/docs/examples/1.7.x/server-nodejs/examples/teams/create-membership.md new file mode 100644 index 0000000000..7994423be0 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/create-membership.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.createMembership( + '<TEAM_ID>', // teamId + [], // roles + 'email@example.com', // email (optional) + '<USER_ID>', // userId (optional) + '+12065550100', // phone (optional) + 'https://example.com', // url (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/create.md b/docs/examples/1.7.x/server-nodejs/examples/teams/create.md new file mode 100644 index 0000000000..94de494bf0 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/create.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.create( + '<TEAM_ID>', // teamId + '<NAME>', // name + [] // roles (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-nodejs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..5264af7f13 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/delete-membership.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.deleteMembership( + '<TEAM_ID>', // teamId + '<MEMBERSHIP_ID>' // membershipId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/delete.md b/docs/examples/1.7.x/server-nodejs/examples/teams/delete.md new file mode 100644 index 0000000000..151bfb3f70 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/delete.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.delete( + '<TEAM_ID>' // teamId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/get-membership.md b/docs/examples/1.7.x/server-nodejs/examples/teams/get-membership.md new file mode 100644 index 0000000000..a8e9fc7311 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/get-membership.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.getMembership( + '<TEAM_ID>', // teamId + '<MEMBERSHIP_ID>' // membershipId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-nodejs/examples/teams/get-prefs.md new file mode 100644 index 0000000000..18afdaa67b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/get-prefs.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.getPrefs( + '<TEAM_ID>' // teamId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/get.md b/docs/examples/1.7.x/server-nodejs/examples/teams/get.md new file mode 100644 index 0000000000..8afc800aa9 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/get.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.get( + '<TEAM_ID>' // teamId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-nodejs/examples/teams/list-memberships.md new file mode 100644 index 0000000000..4fead97b8f --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/list-memberships.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.listMemberships( + '<TEAM_ID>', // teamId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/list.md b/docs/examples/1.7.x/server-nodejs/examples/teams/list.md new file mode 100644 index 0000000000..17fe585224 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/list.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-nodejs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..74fd9580fe --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/update-membership-status.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.updateMembershipStatus( + '<TEAM_ID>', // teamId + '<MEMBERSHIP_ID>', // membershipId + '<USER_ID>', // userId + '<SECRET>' // secret +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/update-membership.md b/docs/examples/1.7.x/server-nodejs/examples/teams/update-membership.md new file mode 100644 index 0000000000..649630ded9 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/update-membership.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.updateMembership( + '<TEAM_ID>', // teamId + '<MEMBERSHIP_ID>', // membershipId + [] // roles +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/update-name.md b/docs/examples/1.7.x/server-nodejs/examples/teams/update-name.md new file mode 100644 index 0000000000..571f7ce399 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/update-name.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.updateName( + '<TEAM_ID>', // teamId + '<NAME>' // name +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-nodejs/examples/teams/update-prefs.md new file mode 100644 index 0000000000..b054694df5 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/teams/update-prefs.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setSession(''); // The user session to authenticate with + +const teams = new sdk.Teams(client); + +const result = await teams.updatePrefs( + '<TEAM_ID>', // teamId + {} // prefs +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-nodejs/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..d1409c4a99 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/tokens/create-file-token.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.createFileToken( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + '' // expire (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/tokens/delete.md b/docs/examples/1.7.x/server-nodejs/examples/tokens/delete.md new file mode 100644 index 0000000000..1249839f65 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/tokens/delete.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.delete( + '<TOKEN_ID>' // tokenId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/tokens/get.md b/docs/examples/1.7.x/server-nodejs/examples/tokens/get.md new file mode 100644 index 0000000000..efb2b8c1b4 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/tokens/get.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.get( + '<TOKEN_ID>' // tokenId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/tokens/list.md b/docs/examples/1.7.x/server-nodejs/examples/tokens/list.md new file mode 100644 index 0000000000..8b708f270f --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/tokens/list.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.list( + '<BUCKET_ID>', // bucketId + '<FILE_ID>', // fileId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/tokens/update.md b/docs/examples/1.7.x/server-nodejs/examples/tokens/update.md new file mode 100644 index 0000000000..ebf5aa9bf8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/tokens/update.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const tokens = new sdk.Tokens(client); + +const result = await tokens.update( + '<TOKEN_ID>', // tokenId + '' // expire (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-argon2user.md new file mode 100644 index 0000000000..dce3646a48 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-argon2user.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createArgon2User( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..d010676d29 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-bcrypt-user.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createBcryptUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..a2c9b59056 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-j-w-t.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createJWT( + '<USER_ID>', // userId + '<SESSION_ID>', // sessionId (optional) + 0 // duration (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..954374c37d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-m-d5user.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createMD5User( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..8b2ed93b23 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createMfaRecoveryCodes( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..eca31fe659 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-p-h-pass-user.md @@ -0,0 +1,15 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createPHPassUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..e7d8588fca --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-s-h-a-user.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createSHAUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + sdk.PasswordHash.Sha1, // passwordVersion (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..831107b569 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,18 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createScryptModifiedUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<PASSWORD_SALT>', // passwordSalt + '<PASSWORD_SALT_SEPARATOR>', // passwordSaltSeparator + '<PASSWORD_SIGNER_KEY>', // passwordSignerKey + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..2c2da7e055 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-scrypt-user.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createScryptUser( + '<USER_ID>', // userId + 'email@example.com', // email + 'password', // password + '<PASSWORD_SALT>', // passwordSalt + null, // passwordCpu + null, // passwordMemory + null, // passwordParallel + null, // passwordLength + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-session.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-session.md new file mode 100644 index 0000000000..9d8cc03ba0 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-session.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createSession( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-target.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-target.md new file mode 100644 index 0000000000..7b9e6b0347 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-target.md @@ -0,0 +1,17 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createTarget( + '<USER_ID>', // userId + '<TARGET_ID>', // targetId + sdk.MessagingProviderType.Email, // providerType + '<IDENTIFIER>', // identifier + '<PROVIDER_ID>', // providerId (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create-token.md b/docs/examples/1.7.x/server-nodejs/examples/users/create-token.md new file mode 100644 index 0000000000..de7d866e8c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create-token.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.createToken( + '<USER_ID>', // userId + 4, // length (optional) + 60 // expire (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/create.md b/docs/examples/1.7.x/server-nodejs/examples/users/create.md new file mode 100644 index 0000000000..025c15ada1 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/create.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.create( + '<USER_ID>', // userId + 'email@example.com', // email (optional) + '+12065550100', // phone (optional) + '', // password (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/delete-identity.md b/docs/examples/1.7.x/server-nodejs/examples/users/delete-identity.md new file mode 100644 index 0000000000..4c92f27d25 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/delete-identity.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteIdentity( + '<IDENTITY_ID>' // identityId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-nodejs/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..456242e22d --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteMfaAuthenticator( + '<USER_ID>', // userId + sdk.AuthenticatorType.Totp // type +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/delete-session.md b/docs/examples/1.7.x/server-nodejs/examples/users/delete-session.md new file mode 100644 index 0000000000..3f08370f3b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/delete-session.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteSession( + '<USER_ID>', // userId + '<SESSION_ID>' // sessionId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-nodejs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..48714a0db1 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/delete-sessions.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteSessions( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/delete-target.md b/docs/examples/1.7.x/server-nodejs/examples/users/delete-target.md new file mode 100644 index 0000000000..ba7e6afd9c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/delete-target.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.deleteTarget( + '<USER_ID>', // userId + '<TARGET_ID>' // targetId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/delete.md b/docs/examples/1.7.x/server-nodejs/examples/users/delete.md new file mode 100644 index 0000000000..8fdd9e90b8 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/delete.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.delete( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-nodejs/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..233c3375ec --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.getMfaRecoveryCodes( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/get-prefs.md b/docs/examples/1.7.x/server-nodejs/examples/users/get-prefs.md new file mode 100644 index 0000000000..61933872e4 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/get-prefs.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.getPrefs( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/get-target.md b/docs/examples/1.7.x/server-nodejs/examples/users/get-target.md new file mode 100644 index 0000000000..00dc1f118b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/get-target.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.getTarget( + '<USER_ID>', // userId + '<TARGET_ID>' // targetId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/get.md b/docs/examples/1.7.x/server-nodejs/examples/users/get.md new file mode 100644 index 0000000000..640aa6315c --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/get.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.get( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/list-identities.md b/docs/examples/1.7.x/server-nodejs/examples/users/list-identities.md new file mode 100644 index 0000000000..819b1688ef --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/list-identities.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listIdentities( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/list-logs.md b/docs/examples/1.7.x/server-nodejs/examples/users/list-logs.md new file mode 100644 index 0000000000..c1155d55e2 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/list-logs.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listLogs( + '<USER_ID>', // userId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/list-memberships.md b/docs/examples/1.7.x/server-nodejs/examples/users/list-memberships.md new file mode 100644 index 0000000000..bbe4ed3711 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/list-memberships.md @@ -0,0 +1,14 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listMemberships( + '<USER_ID>', // userId + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-nodejs/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..8bffa28834 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/list-mfa-factors.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listMfaFactors( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/list-sessions.md b/docs/examples/1.7.x/server-nodejs/examples/users/list-sessions.md new file mode 100644 index 0000000000..51ba0814c4 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/list-sessions.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listSessions( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/list-targets.md b/docs/examples/1.7.x/server-nodejs/examples/users/list-targets.md new file mode 100644 index 0000000000..d991dcca73 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/list-targets.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.listTargets( + '<USER_ID>', // userId + [] // queries (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/list.md b/docs/examples/1.7.x/server-nodejs/examples/users/list.md new file mode 100644 index 0000000000..2bf765bea2 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/list.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.list( + [], // queries (optional) + '<SEARCH>' // search (optional) +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-email-verification.md new file mode 100644 index 0000000000..9dac2d0e54 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-email-verification.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateEmailVerification( + '<USER_ID>', // userId + false // emailVerification +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-email.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-email.md new file mode 100644 index 0000000000..0a8b1aa7af --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-email.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateEmail( + '<USER_ID>', // userId + 'email@example.com' // email +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-labels.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-labels.md new file mode 100644 index 0000000000..db9e8778ad --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-labels.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateLabels( + '<USER_ID>', // userId + [] // labels +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..9d47085370 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateMfaRecoveryCodes( + '<USER_ID>' // userId +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-mfa.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-mfa.md new file mode 100644 index 0000000000..b4acc79938 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-mfa.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateMfa( + '<USER_ID>', // userId + false // mfa +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-name.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-name.md new file mode 100644 index 0000000000..581e57b755 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-name.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateName( + '<USER_ID>', // userId + '<NAME>' // name +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-password.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-password.md new file mode 100644 index 0000000000..f4af49d67e --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-password.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updatePassword( + '<USER_ID>', // userId + '' // password +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..ecbe7591df --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-phone-verification.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updatePhoneVerification( + '<USER_ID>', // userId + false // phoneVerification +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-phone.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-phone.md new file mode 100644 index 0000000000..45e5a6582a --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-phone.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updatePhone( + '<USER_ID>', // userId + '+12065550100' // number +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-prefs.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-prefs.md new file mode 100644 index 0000000000..bb7eff8d6b --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-prefs.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updatePrefs( + '<USER_ID>', // userId + {} // prefs +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-status.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-status.md new file mode 100644 index 0000000000..57f64ce942 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-status.md @@ -0,0 +1,13 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateStatus( + '<USER_ID>', // userId + false // status +); diff --git a/docs/examples/1.7.x/server-nodejs/examples/users/update-target.md b/docs/examples/1.7.x/server-nodejs/examples/users/update-target.md new file mode 100644 index 0000000000..c6e4d9a1b0 --- /dev/null +++ b/docs/examples/1.7.x/server-nodejs/examples/users/update-target.md @@ -0,0 +1,16 @@ +const sdk = require('node-appwrite'); + +const client = new sdk.Client() + .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + .setProject('<YOUR_PROJECT_ID>') // Your project ID + .setKey('<YOUR_API_KEY>'); // Your secret API key + +const users = new sdk.Users(client); + +const result = await users.updateTarget( + '<USER_ID>', // userId + '<TARGET_ID>', // targetId + '<IDENTIFIER>', // identifier (optional) + '<PROVIDER_ID>', // providerId (optional) + '<NAME>' // name (optional) +); diff --git a/docs/examples/1.7.x/server-php/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-php/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..b3e811e18d --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-anonymous-session.md @@ -0,0 +1,12 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createAnonymousSession(); diff --git a/docs/examples/1.7.x/server-php/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-php/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..827b1292c5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-email-password-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createEmailPasswordSession( + email: 'email@example.com', + password: 'password' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create-email-token.md b/docs/examples/1.7.x/server-php/examples/account/create-email-token.md new file mode 100644 index 0000000000..b2c553291b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-email-token.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createEmailToken( + userId: '<USER_ID>', + email: 'email@example.com', + phrase: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-php/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..3dc486502d --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-j-w-t.md @@ -0,0 +1,12 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createJWT(); diff --git a/docs/examples/1.7.x/server-php/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-php/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..639b199756 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createMagicURLToken( + userId: '<USER_ID>', + email: 'email@example.com', + url: 'https://example.com', // optional + phrase: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-php/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..da3b4634e0 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-mfa-authenticator.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\AuthenticatorType; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createMfaAuthenticator( + type: AuthenticatorType::TOTP() +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-php/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..faa679fdf1 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-mfa-challenge.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\AuthenticationFactor; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createMfaChallenge( + factor: AuthenticationFactor::EMAIL() +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-php/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..223c95be97 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-php/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-php/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..1f91db79fd --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-o-auth2token.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\OAuthProvider; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createOAuth2Token( + provider: OAuthProvider::AMAZON(), + success: 'https://example.com', // optional + failure: 'https://example.com', // optional + scopes: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-php/examples/account/create-phone-token.md new file mode 100644 index 0000000000..93c185479e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-phone-token.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createPhoneToken( + userId: '<USER_ID>', + phone: '+12065550100' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-php/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..a152667313 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-phone-verification.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createPhoneVerification(); diff --git a/docs/examples/1.7.x/server-php/examples/account/create-recovery.md b/docs/examples/1.7.x/server-php/examples/account/create-recovery.md new file mode 100644 index 0000000000..c15e41d545 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-recovery.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createRecovery( + email: 'email@example.com', + url: 'https://example.com' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create-session.md b/docs/examples/1.7.x/server-php/examples/account/create-session.md new file mode 100644 index 0000000000..2ff630a2c2 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->createSession( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create-verification.md b/docs/examples/1.7.x/server-php/examples/account/create-verification.md new file mode 100644 index 0000000000..4628175fab --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create-verification.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->createVerification( + url: 'https://example.com' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/create.md b/docs/examples/1.7.x/server-php/examples/account/create.md new file mode 100644 index 0000000000..f92155b6ab --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/create.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->create( + userId: '<USER_ID>', + email: 'email@example.com', + password: '', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/delete-identity.md b/docs/examples/1.7.x/server-php/examples/account/delete-identity.md new file mode 100644 index 0000000000..fd66d3ae24 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/delete-identity.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteIdentity( + identityId: '<IDENTITY_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-php/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..42806f8358 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\AuthenticatorType; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteMfaAuthenticator( + type: AuthenticatorType::TOTP() +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/delete-session.md b/docs/examples/1.7.x/server-php/examples/account/delete-session.md new file mode 100644 index 0000000000..9233ae14e8 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/delete-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteSession( + sessionId: '<SESSION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-php/examples/account/delete-sessions.md new file mode 100644 index 0000000000..557fd6d3aa --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/delete-sessions.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->deleteSessions(); diff --git a/docs/examples/1.7.x/server-php/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-php/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..bafd6d8520 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->getMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-php/examples/account/get-prefs.md b/docs/examples/1.7.x/server-php/examples/account/get-prefs.md new file mode 100644 index 0000000000..c7077affe0 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/get-prefs.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->getPrefs(); diff --git a/docs/examples/1.7.x/server-php/examples/account/get-session.md b/docs/examples/1.7.x/server-php/examples/account/get-session.md new file mode 100644 index 0000000000..be2671348e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/get-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->getSession( + sessionId: '<SESSION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/get.md b/docs/examples/1.7.x/server-php/examples/account/get.md new file mode 100644 index 0000000000..30cb7b2af5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/get.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->get(); diff --git a/docs/examples/1.7.x/server-php/examples/account/list-identities.md b/docs/examples/1.7.x/server-php/examples/account/list-identities.md new file mode 100644 index 0000000000..a7d0a85c66 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/list-identities.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listIdentities( + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/list-logs.md b/docs/examples/1.7.x/server-php/examples/account/list-logs.md new file mode 100644 index 0000000000..cc7a173d2e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/list-logs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listLogs( + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-php/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..6756573cdb --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/list-mfa-factors.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listMfaFactors(); diff --git a/docs/examples/1.7.x/server-php/examples/account/list-sessions.md b/docs/examples/1.7.x/server-php/examples/account/list-sessions.md new file mode 100644 index 0000000000..7f9749f7be --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/list-sessions.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->listSessions(); diff --git a/docs/examples/1.7.x/server-php/examples/account/update-email.md b/docs/examples/1.7.x/server-php/examples/account/update-email.md new file mode 100644 index 0000000000..c7c0d485ea --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-email.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateEmail( + email: 'email@example.com', + password: 'password' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-php/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..a1978e63ac --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-m-f-a.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMFA( + mfa: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-php/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..fc42cbe6d1 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->updateMagicURLSession( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-php/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..6a09d95a10 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-mfa-authenticator.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; +use Appwrite\Enums\AuthenticatorType; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMfaAuthenticator( + type: AuthenticatorType::TOTP(), + otp: '<OTP>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-php/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..03ace31144 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-mfa-challenge.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMfaChallenge( + challengeId: '<CHALLENGE_ID>', + otp: '<OTP>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-php/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..c7ec6cb2b2 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateMfaRecoveryCodes(); diff --git a/docs/examples/1.7.x/server-php/examples/account/update-name.md b/docs/examples/1.7.x/server-php/examples/account/update-name.md new file mode 100644 index 0000000000..2603b6e68b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-name.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateName( + name: '<NAME>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-password.md b/docs/examples/1.7.x/server-php/examples/account/update-password.md new file mode 100644 index 0000000000..c5101381e4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-password.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updatePassword( + password: '', + oldPassword: 'password' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-php/examples/account/update-phone-session.md new file mode 100644 index 0000000000..12d71c2fcd --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-phone-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>'); // Your project ID + +$account = new Account($client); + +$result = $account->updatePhoneSession( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-php/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..df59922996 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-phone-verification.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updatePhoneVerification( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-phone.md b/docs/examples/1.7.x/server-php/examples/account/update-phone.md new file mode 100644 index 0000000000..853cb62fce --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-phone.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updatePhone( + phone: '+12065550100', + password: 'password' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-prefs.md b/docs/examples/1.7.x/server-php/examples/account/update-prefs.md new file mode 100644 index 0000000000..698da0fd8a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-prefs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updatePrefs( + prefs: [] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-recovery.md b/docs/examples/1.7.x/server-php/examples/account/update-recovery.md new file mode 100644 index 0000000000..63518b0029 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-recovery.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateRecovery( + userId: '<USER_ID>', + secret: '<SECRET>', + password: '' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-session.md b/docs/examples/1.7.x/server-php/examples/account/update-session.md new file mode 100644 index 0000000000..11cb4c7d98 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateSession( + sessionId: '<SESSION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/account/update-status.md b/docs/examples/1.7.x/server-php/examples/account/update-status.md new file mode 100644 index 0000000000..7c8075e5c7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-status.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateStatus(); diff --git a/docs/examples/1.7.x/server-php/examples/account/update-verification.md b/docs/examples/1.7.x/server-php/examples/account/update-verification.md new file mode 100644 index 0000000000..60ec0b3196 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/account/update-verification.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Account; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$account = new Account($client); + +$result = $account->updateVerification( + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-php/examples/avatars/get-browser.md new file mode 100644 index 0000000000..2449c26032 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/avatars/get-browser.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; +use Appwrite\Enums\Browser; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getBrowser( + code: Browser::AVANTBROWSER(), + width: 0, // optional + height: 0, // optional + quality: -1 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-php/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..123b345a43 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/avatars/get-credit-card.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; +use Appwrite\Enums\CreditCard; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getCreditCard( + code: CreditCard::AMERICANEXPRESS(), + width: 0, // optional + height: 0, // optional + quality: -1 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-php/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..1e671864c8 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/avatars/get-favicon.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getFavicon( + url: 'https://example.com' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-php/examples/avatars/get-flag.md new file mode 100644 index 0000000000..5b7d8babc7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/avatars/get-flag.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; +use Appwrite\Enums\Flag; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getFlag( + code: Flag::AFGHANISTAN(), + width: 0, // optional + height: 0, // optional + quality: -1 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/avatars/get-image.md b/docs/examples/1.7.x/server-php/examples/avatars/get-image.md new file mode 100644 index 0000000000..e1555453ec --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/avatars/get-image.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getImage( + url: 'https://example.com', + width: 0, // optional + height: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-php/examples/avatars/get-initials.md new file mode 100644 index 0000000000..d84e23a157 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/avatars/get-initials.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getInitials( + name: '<NAME>', // optional + width: 0, // optional + height: 0, // optional + background: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-php/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..0d5936af6b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/avatars/get-q-r.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Avatars; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$avatars = new Avatars($client); + +$result = $avatars->getQR( + text: '<TEXT>', + size: 1, // optional + margin: 0, // optional + download: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..805d022194 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-boolean-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createBooleanAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: false, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-collection.md b/docs/examples/1.7.x/server-php/examples/databases/create-collection.md new file mode 100644 index 0000000000..700d97177b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-collection.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', + permissions: ["read("any")"], // optional + documentSecurity: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..dd2fcecc80 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-datetime-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createDatetimeAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-document.md b/docs/examples/1.7.x/server-php/examples/databases/create-document.md new file mode 100644 index 0000000000..8726b37719 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-document.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setSession('') // The user session to authenticate with + ->setKey('<YOUR_API_KEY>') // Your secret API key + ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +$databases = new Databases($client); + +$result = $databases->createDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + data: [], + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-documents.md b/docs/examples/1.7.x/server-php/examples/databases/create-documents.md new file mode 100644 index 0000000000..96008e2495 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-documents.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createDocuments( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documents: [] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..1274a4b9e1 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-email-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createEmailAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: 'email@example.com', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..9abf2dfa1b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-enum-attribute.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createEnumAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + elements: [], + required: false, + default: '<DEFAULT>', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..e6eecb5298 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-float-attribute.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createFloatAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + default: null, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-index.md b/docs/examples/1.7.x/server-php/examples/databases/create-index.md new file mode 100644 index 0000000000..9e8a221e13 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-index.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; +use Appwrite\Enums\IndexType; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createIndex( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + type: IndexType::KEY(), + attributes: [], + orders: [], // optional + lengths: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..1dbeefa547 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-integer-attribute.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createIntegerAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + min: null, // optional + max: null, // optional + default: null, // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..f42717caa4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-ip-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createIpAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..caccd36031 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-relationship-attribute.md @@ -0,0 +1,23 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; +use Appwrite\Enums\RelationshipType; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createRelationshipAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + relatedCollectionId: '<RELATED_COLLECTION_ID>', + type: RelationshipType::ONETOONE(), + twoWay: false, // optional + key: '', // optional + twoWayKey: '', // optional + onDelete: RelationMutate::CASCADE() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..5a4f72b6c8 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-string-attribute.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createStringAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + size: 1, + required: false, + default: '<DEFAULT>', // optional + array: false, // optional + encrypt: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..6b9bc800e5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create-url-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->createUrlAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: 'https://example.com', // optional + array: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/create.md b/docs/examples/1.7.x/server-php/examples/databases/create.md new file mode 100644 index 0000000000..73c618874a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/create.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->create( + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..71b7162655 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/delete-attribute.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->deleteAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-php/examples/databases/delete-collection.md new file mode 100644 index 0000000000..4e98dfdb4e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/delete-collection.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->deleteCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/delete-document.md b/docs/examples/1.7.x/server-php/examples/databases/delete-document.md new file mode 100644 index 0000000000..def7f24569 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/delete-document.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$databases = new Databases($client); + +$result = $databases->deleteDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-php/examples/databases/delete-documents.md new file mode 100644 index 0000000000..3552d85317 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/delete-documents.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->deleteDocuments( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/delete-index.md b/docs/examples/1.7.x/server-php/examples/databases/delete-index.md new file mode 100644 index 0000000000..79e476b6d0 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/delete-index.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->deleteIndex( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/delete.md b/docs/examples/1.7.x/server-php/examples/databases/delete.md new file mode 100644 index 0000000000..c796b7c406 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->delete( + databaseId: '<DATABASE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/get-attribute.md new file mode 100644 index 0000000000..ba82db4065 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/get-attribute.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->getAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/get-collection.md b/docs/examples/1.7.x/server-php/examples/databases/get-collection.md new file mode 100644 index 0000000000..ecddab053d --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/get-collection.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->getCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/get-document.md b/docs/examples/1.7.x/server-php/examples/databases/get-document.md new file mode 100644 index 0000000000..a3204c50a7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/get-document.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$databases = new Databases($client); + +$result = $databases->getDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/get-index.md b/docs/examples/1.7.x/server-php/examples/databases/get-index.md new file mode 100644 index 0000000000..e9c6307671 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/get-index.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->getIndex( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/get.md b/docs/examples/1.7.x/server-php/examples/databases/get.md new file mode 100644 index 0000000000..9aa6395587 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->get( + databaseId: '<DATABASE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-php/examples/databases/list-attributes.md new file mode 100644 index 0000000000..3105fc419c --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/list-attributes.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->listAttributes( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/list-collections.md b/docs/examples/1.7.x/server-php/examples/databases/list-collections.md new file mode 100644 index 0000000000..533b26a055 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/list-collections.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->listCollections( + databaseId: '<DATABASE_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/list-documents.md b/docs/examples/1.7.x/server-php/examples/databases/list-documents.md new file mode 100644 index 0000000000..07183ac8bf --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/list-documents.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$databases = new Databases($client); + +$result = $databases->listDocuments( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-php/examples/databases/list-indexes.md new file mode 100644 index 0000000000..65b45dae80 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/list-indexes.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->listIndexes( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/list.md b/docs/examples/1.7.x/server-php/examples/databases/list.md new file mode 100644 index 0000000000..6bba74da59 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/list.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->list( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..2e4bee72fe --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-boolean-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateBooleanAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: false, + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-collection.md b/docs/examples/1.7.x/server-php/examples/databases/update-collection.md new file mode 100644 index 0000000000..dd030c0792 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-collection.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateCollection( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + name: '<NAME>', + permissions: ["read("any")"], // optional + documentSecurity: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..b1a03ec028 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-datetime-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateDatetimeAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-document.md b/docs/examples/1.7.x/server-php/examples/databases/update-document.md new file mode 100644 index 0000000000..f1c8a34680 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-document.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$databases = new Databases($client); + +$result = $databases->updateDocument( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documentId: '<DOCUMENT_ID>', + data: [], // optional + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-documents.md b/docs/examples/1.7.x/server-php/examples/databases/update-documents.md new file mode 100644 index 0000000000..51b4e18bc2 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-documents.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateDocuments( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + data: [], // optional + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..dc9865f81a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-email-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateEmailAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: 'email@example.com', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..f7cd0b7b83 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-enum-attribute.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateEnumAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + elements: [], + required: false, + default: '<DEFAULT>', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..51f6ec9239 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-float-attribute.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateFloatAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..bdbd96ca12 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-integer-attribute.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateIntegerAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: null, + min: null, // optional + max: null, // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..130cd0cc9f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-ip-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateIpAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..01783cf3bf --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-relationship-attribute.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateRelationshipAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + onDelete: RelationMutate::CASCADE(), // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..e0c8f992ea --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-string-attribute.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateStringAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: '<DEFAULT>', + size: 1, // optional + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-php/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..c200463894 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update-url-attribute.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->updateUrlAttribute( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + key: '', + required: false, + default: 'https://example.com', + newKey: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/update.md b/docs/examples/1.7.x/server-php/examples/databases/update.md new file mode 100644 index 0000000000..9b0b0789ca --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/update.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->update( + databaseId: '<DATABASE_ID>', + name: '<NAME>', + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-php/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..7b9459e8f4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/databases/upsert-documents.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Databases; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$databases = new Databases($client); + +$result = $databases->upsertDocuments( + databaseId: '<DATABASE_ID>', + collectionId: '<COLLECTION_ID>', + documents: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-php/examples/functions/create-deployment.md new file mode 100644 index 0000000000..7e48b89ca7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/create-deployment.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\InputFile; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->createDeployment( + functionId: '<FUNCTION_ID>', + code: InputFile::withPath('file.png'), + activate: false, + entrypoint: '<ENTRYPOINT>', // optional + commands: '<COMMANDS>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-php/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..a898762cb8 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->createDuplicateDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', + buildId: '<BUILD_ID>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/create-execution.md b/docs/examples/1.7.x/server-php/examples/functions/create-execution.md new file mode 100644 index 0000000000..9aeb976cf3 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/create-execution.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$functions = new Functions($client); + +$result = $functions->createExecution( + functionId: '<FUNCTION_ID>', + body: '<BODY>', // optional + async: false, // optional + path: '<PATH>', // optional + method: ExecutionMethod::GET(), // optional + headers: [], // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-php/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..9d22bdc1b4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/create-template-deployment.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->createTemplateDeployment( + functionId: '<FUNCTION_ID>', + repository: '<REPOSITORY>', + owner: '<OWNER>', + rootDirectory: '<ROOT_DIRECTORY>', + version: '<VERSION>', + activate: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/create-variable.md b/docs/examples/1.7.x/server-php/examples/functions/create-variable.md new file mode 100644 index 0000000000..ec470d5457 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/create-variable.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->createVariable( + functionId: '<FUNCTION_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-php/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..bb4622e67a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/create-vcs-deployment.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; +use Appwrite\Enums\VCSDeploymentType; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->createVcsDeployment( + functionId: '<FUNCTION_ID>', + type: VCSDeploymentType::BRANCH(), + reference: '<REFERENCE>', + activate: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/create.md b/docs/examples/1.7.x/server-php/examples/functions/create.md new file mode 100644 index 0000000000..3d37b8068e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/create.md @@ -0,0 +1,33 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; +use Appwrite\Enums\; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->create( + functionId: '<FUNCTION_ID>', + name: '<NAME>', + runtime: ::NODE145(), + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '<ENTRYPOINT>', // optional + commands: '<COMMANDS>', // optional + scopes: [], // optional + installationId: '<INSTALLATION_ID>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + specification: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-php/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..20285d7610 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/delete-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->deleteDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-php/examples/functions/delete-execution.md new file mode 100644 index 0000000000..e55a8b1892 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/delete-execution.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->deleteExecution( + functionId: '<FUNCTION_ID>', + executionId: '<EXECUTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-php/examples/functions/delete-variable.md new file mode 100644 index 0000000000..e1fb391d79 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/delete-variable.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->deleteVariable( + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/delete.md b/docs/examples/1.7.x/server-php/examples/functions/delete.md new file mode 100644 index 0000000000..9f87f5c9f0 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->delete( + functionId: '<FUNCTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-php/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..7b3e18751e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/get-deployment-download.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->getDeploymentDownload( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>', + type: DeploymentDownloadType::SOURCE() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-php/examples/functions/get-deployment.md new file mode 100644 index 0000000000..945933b2ad --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/get-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->getDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/get-execution.md b/docs/examples/1.7.x/server-php/examples/functions/get-execution.md new file mode 100644 index 0000000000..7dfeeed0c0 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/get-execution.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$functions = new Functions($client); + +$result = $functions->getExecution( + functionId: '<FUNCTION_ID>', + executionId: '<EXECUTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/get-variable.md b/docs/examples/1.7.x/server-php/examples/functions/get-variable.md new file mode 100644 index 0000000000..4c8d3d6b53 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/get-variable.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->getVariable( + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/get.md b/docs/examples/1.7.x/server-php/examples/functions/get.md new file mode 100644 index 0000000000..ca2160f6c9 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->get( + functionId: '<FUNCTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-php/examples/functions/list-deployments.md new file mode 100644 index 0000000000..7bbaa0ed3e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/list-deployments.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->listDeployments( + functionId: '<FUNCTION_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/list-executions.md b/docs/examples/1.7.x/server-php/examples/functions/list-executions.md new file mode 100644 index 0000000000..77a8ba7223 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/list-executions.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$functions = new Functions($client); + +$result = $functions->listExecutions( + functionId: '<FUNCTION_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-php/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..6c77c42678 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/list-runtimes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->listRuntimes(); diff --git a/docs/examples/1.7.x/server-php/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-php/examples/functions/list-specifications.md new file mode 100644 index 0000000000..eec5c33c9d --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/list-specifications.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->listSpecifications(); diff --git a/docs/examples/1.7.x/server-php/examples/functions/list-variables.md b/docs/examples/1.7.x/server-php/examples/functions/list-variables.md new file mode 100644 index 0000000000..f85e85490c --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/list-variables.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->listVariables( + functionId: '<FUNCTION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/list.md b/docs/examples/1.7.x/server-php/examples/functions/list.md new file mode 100644 index 0000000000..de914afc58 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/list.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->list( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-php/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..de36d4e8ce --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/update-deployment-status.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->updateDeploymentStatus( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-php/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..38ba026ba1 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/update-function-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->updateFunctionDeployment( + functionId: '<FUNCTION_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/update-variable.md b/docs/examples/1.7.x/server-php/examples/functions/update-variable.md new file mode 100644 index 0000000000..b15597a622 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/update-variable.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->updateVariable( + functionId: '<FUNCTION_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', // optional + secret: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/functions/update.md b/docs/examples/1.7.x/server-php/examples/functions/update.md new file mode 100644 index 0000000000..ea8d863ae5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/functions/update.md @@ -0,0 +1,32 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Functions; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$functions = new Functions($client); + +$result = $functions->update( + functionId: '<FUNCTION_ID>', + name: '<NAME>', + runtime: ::NODE145(), // optional + execute: ["any"], // optional + events: [], // optional + schedule: '', // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: '<ENTRYPOINT>', // optional + commands: '<COMMANDS>', // optional + scopes: [], // optional + installationId: '<INSTALLATION_ID>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + specification: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/graphql/mutation.md b/docs/examples/1.7.x/server-php/examples/graphql/mutation.md new file mode 100644 index 0000000000..c349bc2dbd --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/graphql/mutation.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Graphql; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$graphql = new Graphql($client); + +$result = $graphql->mutation( + query: [] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/graphql/query.md b/docs/examples/1.7.x/server-php/examples/graphql/query.md new file mode 100644 index 0000000000..e6e277c27b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/graphql/query.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Graphql; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$graphql = new Graphql($client); + +$result = $graphql->query( + query: [] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-php/examples/health/get-antivirus.md new file mode 100644 index 0000000000..47210646df --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-antivirus.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getAntivirus(); diff --git a/docs/examples/1.7.x/server-php/examples/health/get-cache.md b/docs/examples/1.7.x/server-php/examples/health/get-cache.md new file mode 100644 index 0000000000..2e81dae328 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-cache.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getCache(); diff --git a/docs/examples/1.7.x/server-php/examples/health/get-certificate.md b/docs/examples/1.7.x/server-php/examples/health/get-certificate.md new file mode 100644 index 0000000000..408581beac --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-certificate.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getCertificate( + domain: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-d-b.md b/docs/examples/1.7.x/server-php/examples/health/get-d-b.md new file mode 100644 index 0000000000..cfec70e604 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-d-b.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getDB(); diff --git a/docs/examples/1.7.x/server-php/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-php/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..02959db3b5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-failed-jobs.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; +use Appwrite\Enums\; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getFailedJobs( + name: ::V1DATABASE(), + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-php/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..1c346caab6 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-pub-sub.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getPubSub(); diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..8c1f77433b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-builds.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueBuilds( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..92fb79a98c --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-certificates.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueCertificates( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..745b469434 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-databases.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueDatabases( + name: '<NAME>', // optional + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..d3952685c4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-deletes.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueDeletes( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..1a5bea2b4c --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-functions.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueFunctions( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..cf5e3b9d83 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-logs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueLogs( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..132dfa68aa --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-mails.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueMails( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..fd5fdb1ede --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-messaging.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueMessaging( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..68110189e5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-migrations.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueMigrations( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..d0bd6c054e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-stats-resources.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueStatsResources( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..627a85c845 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-usage.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueUsage( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-php/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..d6ccd7cd83 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-queue-webhooks.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getQueueWebhooks( + threshold: null // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-php/examples/health/get-storage-local.md new file mode 100644 index 0000000000..041d24954c --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-storage-local.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getStorageLocal(); diff --git a/docs/examples/1.7.x/server-php/examples/health/get-storage.md b/docs/examples/1.7.x/server-php/examples/health/get-storage.md new file mode 100644 index 0000000000..377416ed13 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-storage.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getStorage(); diff --git a/docs/examples/1.7.x/server-php/examples/health/get-time.md b/docs/examples/1.7.x/server-php/examples/health/get-time.md new file mode 100644 index 0000000000..aa2699349d --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get-time.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->getTime(); diff --git a/docs/examples/1.7.x/server-php/examples/health/get.md b/docs/examples/1.7.x/server-php/examples/health/get.md new file mode 100644 index 0000000000..fec3e3f485 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/health/get.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Health; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$health = new Health($client); + +$result = $health->get(); diff --git a/docs/examples/1.7.x/server-php/examples/locale/get.md b/docs/examples/1.7.x/server-php/examples/locale/get.md new file mode 100644 index 0000000000..ef4c0432dd --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/locale/get.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->get(); diff --git a/docs/examples/1.7.x/server-php/examples/locale/list-codes.md b/docs/examples/1.7.x/server-php/examples/locale/list-codes.md new file mode 100644 index 0000000000..273fad0839 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/locale/list-codes.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCodes(); diff --git a/docs/examples/1.7.x/server-php/examples/locale/list-continents.md b/docs/examples/1.7.x/server-php/examples/locale/list-continents.md new file mode 100644 index 0000000000..e8c7ca46df --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/locale/list-continents.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listContinents(); diff --git a/docs/examples/1.7.x/server-php/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-php/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..c5dd1d2ad6 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/locale/list-countries-e-u.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCountriesEU(); diff --git a/docs/examples/1.7.x/server-php/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-php/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..7585c1071e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/locale/list-countries-phones.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCountriesPhones(); diff --git a/docs/examples/1.7.x/server-php/examples/locale/list-countries.md b/docs/examples/1.7.x/server-php/examples/locale/list-countries.md new file mode 100644 index 0000000000..63a2e0b5f7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/locale/list-countries.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCountries(); diff --git a/docs/examples/1.7.x/server-php/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-php/examples/locale/list-currencies.md new file mode 100644 index 0000000000..d385018e7d --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/locale/list-currencies.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listCurrencies(); diff --git a/docs/examples/1.7.x/server-php/examples/locale/list-languages.md b/docs/examples/1.7.x/server-php/examples/locale/list-languages.md new file mode 100644 index 0000000000..f0ca4d4f04 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/locale/list-languages.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Locale; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$locale = new Locale($client); + +$result = $locale->listLanguages(); diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..da13d17231 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-apns-provider.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createApnsProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + authKey: '<AUTH_KEY>', // optional + authKeyId: '<AUTH_KEY_ID>', // optional + teamId: '<TEAM_ID>', // optional + bundleId: '<BUNDLE_ID>', // optional + sandbox: false, // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-email.md b/docs/examples/1.7.x/server-php/examples/messaging/create-email.md new file mode 100644 index 0000000000..9de24873bf --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-email.md @@ -0,0 +1,26 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createEmail( + messageId: '<MESSAGE_ID>', + subject: '<SUBJECT>', + content: '<CONTENT>', + topics: [], // optional + users: [], // optional + targets: [], // optional + cc: [], // optional + bcc: [], // optional + attachments: [], // optional + draft: false, // optional + html: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..baf72a1df4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-fcm-provider.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createFcmProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + serviceAccountJSON: [], // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..6c62ee8837 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,24 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createMailgunProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // optional + domain: '<DOMAIN>', // optional + isEuRegion: false, // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..1eb954a2c6 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-msg91provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createMsg91Provider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + templateId: '<TEMPLATE_ID>', // optional + senderId: '<SENDER_ID>', // optional + authKey: '<AUTH_KEY>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-push.md b/docs/examples/1.7.x/server-php/examples/messaging/create-push.md new file mode 100644 index 0000000000..46aeeb3b8b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-push.md @@ -0,0 +1,33 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createPush( + messageId: '<MESSAGE_ID>', + title: '<TITLE>', // optional + body: '<BODY>', // optional + topics: [], // optional + users: [], // optional + targets: [], // optional + data: [], // optional + action: '<ACTION>', // optional + image: '[ID1:ID2]', // optional + icon: '<ICON>', // optional + sound: '<SOUND>', // optional + color: '<COLOR>', // optional + tag: '<TAG>', // optional + badge: null, // optional + draft: false, // optional + scheduledAt: '', // optional + contentAvailable: false, // optional + critical: false, // optional + priority: MessagePriority::NORMAL() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..892d856305 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createSendgridProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-php/examples/messaging/create-sms.md new file mode 100644 index 0000000000..1e2d9ac765 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-sms.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createSms( + messageId: '<MESSAGE_ID>', + content: '<CONTENT>', + topics: [], // optional + users: [], // optional + targets: [], // optional + draft: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..4dcfb3a088 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-smtp-provider.md @@ -0,0 +1,28 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createSmtpProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', + port: 1, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + encryption: SmtpEncryption::NONE(), // optional + autoTLS: false, // optional + mailer: '<MAILER>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: 'email@example.com', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-php/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..3516fa3d6a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-subscriber.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +$messaging = new Messaging($client); + +$result = $messaging->createSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>', + targetId: '<TARGET_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..9006918029 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-telesign-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createTelesignProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + customerId: '<CUSTOMER_ID>', // optional + apiKey: '<API_KEY>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..5215d52642 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createTextmagicProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + username: '<USERNAME>', // optional + apiKey: '<API_KEY>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-php/examples/messaging/create-topic.md new file mode 100644 index 0000000000..e94141cc73 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-topic.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createTopic( + topicId: '<TOPIC_ID>', + name: '<NAME>', + subscribe: ["any"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..c356828640 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-twilio-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createTwilioProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + accountSid: '<ACCOUNT_SID>', // optional + authToken: '<AUTH_TOKEN>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..adeacbc45e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/create-vonage-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->createVonageProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', // optional + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..f37d18b4fd --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/delete-provider.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->deleteProvider( + providerId: '<PROVIDER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-php/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..f7a8425920 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/delete-subscriber.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setJWT('<YOUR_JWT>'); // Your secret JSON Web Token + +$messaging = new Messaging($client); + +$result = $messaging->deleteSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-php/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..2ec899b1d6 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/delete-topic.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->deleteTopic( + topicId: '<TOPIC_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/delete.md b/docs/examples/1.7.x/server-php/examples/messaging/delete.md new file mode 100644 index 0000000000..5781838bdc --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->delete( + messageId: '<MESSAGE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/get-message.md b/docs/examples/1.7.x/server-php/examples/messaging/get-message.md new file mode 100644 index 0000000000..cf922219c7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/get-message.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->getMessage( + messageId: '<MESSAGE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/get-provider.md new file mode 100644 index 0000000000..d19f5c65e5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/get-provider.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->getProvider( + providerId: '<PROVIDER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-php/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..e2a0d7ef35 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/get-subscriber.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->getSubscriber( + topicId: '<TOPIC_ID>', + subscriberId: '<SUBSCRIBER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-php/examples/messaging/get-topic.md new file mode 100644 index 0000000000..fc06cbbc95 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/get-topic.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->getTopic( + topicId: '<TOPIC_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-php/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..03231375f8 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/list-message-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listMessageLogs( + messageId: '<MESSAGE_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-php/examples/messaging/list-messages.md new file mode 100644 index 0000000000..965fe08fc7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/list-messages.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listMessages( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-php/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..761bb966d6 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/list-provider-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listProviderLogs( + providerId: '<PROVIDER_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-php/examples/messaging/list-providers.md new file mode 100644 index 0000000000..614e9c58f1 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/list-providers.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listProviders( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-php/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..c710575a46 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listSubscriberLogs( + subscriberId: '<SUBSCRIBER_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-php/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..d2625cd555 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/list-subscribers.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listSubscribers( + topicId: '<TOPIC_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-php/examples/messaging/list-targets.md new file mode 100644 index 0000000000..1112d28003 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/list-targets.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listTargets( + messageId: '<MESSAGE_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-php/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..3bbb35a006 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/list-topic-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listTopicLogs( + topicId: '<TOPIC_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-php/examples/messaging/list-topics.md new file mode 100644 index 0000000000..debb363133 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/list-topics.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->listTopics( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..724453b9b1 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-apns-provider.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateApnsProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + authKey: '<AUTH_KEY>', // optional + authKeyId: '<AUTH_KEY_ID>', // optional + teamId: '<TEAM_ID>', // optional + bundleId: '<BUNDLE_ID>', // optional + sandbox: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-email.md b/docs/examples/1.7.x/server-php/examples/messaging/update-email.md new file mode 100644 index 0000000000..dd0f645af6 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-email.md @@ -0,0 +1,26 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateEmail( + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + subject: '<SUBJECT>', // optional + content: '<CONTENT>', // optional + draft: false, // optional + html: false, // optional + cc: [], // optional + bcc: [], // optional + scheduledAt: '', // optional + attachments: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..36672f4b65 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-fcm-provider.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateFcmProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + serviceAccountJSON: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..c99ebc7d73 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,24 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateMailgunProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + apiKey: '<API_KEY>', // optional + domain: '<DOMAIN>', // optional + isEuRegion: false, // optional + enabled: false, // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..f6f557cce4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-msg91provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateMsg91Provider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + templateId: '<TEMPLATE_ID>', // optional + senderId: '<SENDER_ID>', // optional + authKey: '<AUTH_KEY>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-push.md b/docs/examples/1.7.x/server-php/examples/messaging/update-push.md new file mode 100644 index 0000000000..e1df0b9132 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-push.md @@ -0,0 +1,33 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updatePush( + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + title: '<TITLE>', // optional + body: '<BODY>', // optional + data: [], // optional + action: '<ACTION>', // optional + image: '[ID1:ID2]', // optional + icon: '<ICON>', // optional + sound: '<SOUND>', // optional + color: '<COLOR>', // optional + tag: '<TAG>', // optional + badge: null, // optional + draft: false, // optional + scheduledAt: '', // optional + contentAvailable: false, // optional + critical: false, // optional + priority: MessagePriority::NORMAL() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..b8473c16a3 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,22 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateSendgridProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-php/examples/messaging/update-sms.md new file mode 100644 index 0000000000..730da4178a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-sms.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateSms( + messageId: '<MESSAGE_ID>', + topics: [], // optional + users: [], // optional + targets: [], // optional + content: '<CONTENT>', // optional + draft: false, // optional + scheduledAt: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..a16a630283 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-smtp-provider.md @@ -0,0 +1,28 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateSmtpProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + host: '<HOST>', // optional + port: 1, // optional + username: '<USERNAME>', // optional + password: '<PASSWORD>', // optional + encryption: SmtpEncryption::NONE(), // optional + autoTLS: false, // optional + mailer: '<MAILER>', // optional + fromName: '<FROM_NAME>', // optional + fromEmail: 'email@example.com', // optional + replyToName: '<REPLY_TO_NAME>', // optional + replyToEmail: '<REPLY_TO_EMAIL>', // optional + enabled: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..29a54bfaed --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-telesign-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateTelesignProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + customerId: '<CUSTOMER_ID>', // optional + apiKey: '<API_KEY>', // optional + from: '<FROM>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..e6a1ed1a1e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateTextmagicProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + username: '<USERNAME>', // optional + apiKey: '<API_KEY>', // optional + from: '<FROM>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-php/examples/messaging/update-topic.md new file mode 100644 index 0000000000..b1f9a32ec5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-topic.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateTopic( + topicId: '<TOPIC_ID>', + name: '<NAME>', // optional + subscribe: ["any"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..def821adc4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-twilio-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateTwilioProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + accountSid: '<ACCOUNT_SID>', // optional + authToken: '<AUTH_TOKEN>', // optional + from: '<FROM>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-php/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..0841e284eb --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/messaging/update-vonage-provider.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Messaging; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$messaging = new Messaging($client); + +$result = $messaging->updateVonageProvider( + providerId: '<PROVIDER_ID>', + name: '<NAME>', // optional + enabled: false, // optional + apiKey: '<API_KEY>', // optional + apiSecret: '<API_SECRET>', // optional + from: '<FROM>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-php/examples/sites/create-deployment.md new file mode 100644 index 0000000000..30770b7871 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/create-deployment.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\InputFile; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->createDeployment( + siteId: '<SITE_ID>', + code: InputFile::withPath('file.png'), + activate: false, + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-php/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..84f65cd025 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->createDuplicateDeployment( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-php/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..f2d1f3cd8b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/create-template-deployment.md @@ -0,0 +1,20 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->createTemplateDeployment( + siteId: '<SITE_ID>', + repository: '<REPOSITORY>', + owner: '<OWNER>', + rootDirectory: '<ROOT_DIRECTORY>', + version: '<VERSION>', + activate: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/create-variable.md b/docs/examples/1.7.x/server-php/examples/sites/create-variable.md new file mode 100644 index 0000000000..3097e19305 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/create-variable.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->createVariable( + siteId: '<SITE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-php/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..7f63dffdf8 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/create-vcs-deployment.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; +use Appwrite\Enums\VCSDeploymentType; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->createVcsDeployment( + siteId: '<SITE_ID>', + type: VCSDeploymentType::BRANCH(), + reference: '<REFERENCE>', + activate: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/create.md b/docs/examples/1.7.x/server-php/examples/sites/create.md new file mode 100644 index 0000000000..4a1c3a4fcb --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/create.md @@ -0,0 +1,34 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; +use Appwrite\Enums\; +use Appwrite\Enums\; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->create( + siteId: '<SITE_ID>', + name: '<NAME>', + framework: ::ANALOG(), + buildRuntime: ::NODE145(), + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>', // optional + adapter: ::STATIC(), // optional + installationId: '<INSTALLATION_ID>', // optional + fallbackFile: '<FALLBACK_FILE>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + specification: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-php/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..4e24748c37 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/delete-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->deleteDeployment( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/delete-log.md b/docs/examples/1.7.x/server-php/examples/sites/delete-log.md new file mode 100644 index 0000000000..b6e30643f6 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/delete-log.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->deleteLog( + siteId: '<SITE_ID>', + logId: '<LOG_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-php/examples/sites/delete-variable.md new file mode 100644 index 0000000000..663254303a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/delete-variable.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->deleteVariable( + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/delete.md b/docs/examples/1.7.x/server-php/examples/sites/delete.md new file mode 100644 index 0000000000..8e6363aa35 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->delete( + siteId: '<SITE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-php/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..91c6b6e52a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/get-deployment-download.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->getDeploymentDownload( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>', + type: DeploymentDownloadType::SOURCE() // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-php/examples/sites/get-deployment.md new file mode 100644 index 0000000000..19525d9274 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/get-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->getDeployment( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/get-log.md b/docs/examples/1.7.x/server-php/examples/sites/get-log.md new file mode 100644 index 0000000000..5ceb2b9110 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/get-log.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->getLog( + siteId: '<SITE_ID>', + logId: '<LOG_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/get-variable.md b/docs/examples/1.7.x/server-php/examples/sites/get-variable.md new file mode 100644 index 0000000000..0cab412b2e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/get-variable.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->getVariable( + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/get.md b/docs/examples/1.7.x/server-php/examples/sites/get.md new file mode 100644 index 0000000000..e5ec061bad --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->get( + siteId: '<SITE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-php/examples/sites/list-deployments.md new file mode 100644 index 0000000000..4d687ec59e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/list-deployments.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->listDeployments( + siteId: '<SITE_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-php/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..87df92d9ee --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/list-frameworks.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->listFrameworks(); diff --git a/docs/examples/1.7.x/server-php/examples/sites/list-logs.md b/docs/examples/1.7.x/server-php/examples/sites/list-logs.md new file mode 100644 index 0000000000..5674e98f5e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/list-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->listLogs( + siteId: '<SITE_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-php/examples/sites/list-specifications.md new file mode 100644 index 0000000000..42dae1b799 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/list-specifications.md @@ -0,0 +1,13 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->listSpecifications(); diff --git a/docs/examples/1.7.x/server-php/examples/sites/list-variables.md b/docs/examples/1.7.x/server-php/examples/sites/list-variables.md new file mode 100644 index 0000000000..36aad640fe --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/list-variables.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->listVariables( + siteId: '<SITE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/list.md b/docs/examples/1.7.x/server-php/examples/sites/list.md new file mode 100644 index 0000000000..4e16c690bc --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/list.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->list( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-php/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..2714b3570f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/update-deployment-status.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->updateDeploymentStatus( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-php/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..6e2614cb41 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/update-site-deployment.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->updateSiteDeployment( + siteId: '<SITE_ID>', + deploymentId: '<DEPLOYMENT_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/update-variable.md b/docs/examples/1.7.x/server-php/examples/sites/update-variable.md new file mode 100644 index 0000000000..84bafe28c4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/update-variable.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->updateVariable( + siteId: '<SITE_ID>', + variableId: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', // optional + secret: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/sites/update.md b/docs/examples/1.7.x/server-php/examples/sites/update.md new file mode 100644 index 0000000000..f2ca54a987 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/sites/update.md @@ -0,0 +1,33 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Sites; +use Appwrite\Enums\; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$sites = new Sites($client); + +$result = $sites->update( + siteId: '<SITE_ID>', + name: '<NAME>', + framework: ::ANALOG(), + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: '<INSTALL_COMMAND>', // optional + buildCommand: '<BUILD_COMMAND>', // optional + outputDirectory: '<OUTPUT_DIRECTORY>', // optional + buildRuntime: ::NODE145(), // optional + adapter: ::STATIC(), // optional + fallbackFile: '<FALLBACK_FILE>', // optional + installationId: '<INSTALLATION_ID>', // optional + providerRepositoryId: '<PROVIDER_REPOSITORY_ID>', // optional + providerBranch: '<PROVIDER_BRANCH>', // optional + providerSilentMode: false, // optional + providerRootDirectory: '<PROVIDER_ROOT_DIRECTORY>', // optional + specification: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-php/examples/storage/create-bucket.md new file mode 100644 index 0000000000..cd17ffedac --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/create-bucket.md @@ -0,0 +1,24 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->createBucket( + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: ::NONE(), // optional + encryption: false, // optional + antivirus: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/create-file.md b/docs/examples/1.7.x/server-php/examples/storage/create-file.md new file mode 100644 index 0000000000..2d13305984 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/create-file.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\InputFile; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->createFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + file: InputFile::withPath('file.png'), + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-php/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..50adf35b6b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/delete-bucket.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->deleteBucket( + bucketId: '<BUCKET_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/delete-file.md b/docs/examples/1.7.x/server-php/examples/storage/delete-file.md new file mode 100644 index 0000000000..d4c45eb66a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/delete-file.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->deleteFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-php/examples/storage/get-bucket.md new file mode 100644 index 0000000000..e62c43d2d3 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/get-bucket.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->getBucket( + bucketId: '<BUCKET_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-php/examples/storage/get-file-download.md new file mode 100644 index 0000000000..defefa5948 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/get-file-download.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->getFileDownload( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + token: '<TOKEN>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-php/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..0b65fc326a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/get-file-preview.md @@ -0,0 +1,28 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->getFilePreview( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + width: 0, // optional + height: 0, // optional + gravity: ImageGravity::CENTER(), // optional + quality: -1, // optional + borderWidth: 0, // optional + borderColor: '', // optional + borderRadius: 0, // optional + opacity: 0, // optional + rotation: -360, // optional + background: '', // optional + output: ImageFormat::JPG(), // optional + token: '<TOKEN>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-php/examples/storage/get-file-view.md new file mode 100644 index 0000000000..dfc84ca102 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/get-file-view.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->getFileView( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + token: '<TOKEN>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/get-file.md b/docs/examples/1.7.x/server-php/examples/storage/get-file.md new file mode 100644 index 0000000000..6964144801 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/get-file.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->getFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-php/examples/storage/list-buckets.md new file mode 100644 index 0000000000..a4538c6f3a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/list-buckets.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->listBuckets( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/list-files.md b/docs/examples/1.7.x/server-php/examples/storage/list-files.md new file mode 100644 index 0000000000..ede0e7c979 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/list-files.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->listFiles( + bucketId: '<BUCKET_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-php/examples/storage/update-bucket.md new file mode 100644 index 0000000000..1517e36621 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/update-bucket.md @@ -0,0 +1,24 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$storage = new Storage($client); + +$result = $storage->updateBucket( + bucketId: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: ::NONE(), // optional + encryption: false, // optional + antivirus: false // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/storage/update-file.md b/docs/examples/1.7.x/server-php/examples/storage/update-file.md new file mode 100644 index 0000000000..7b467acfe3 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/storage/update-file.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Storage; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$storage = new Storage($client); + +$result = $storage->updateFile( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + name: '<NAME>', // optional + permissions: ["read("any")"] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/create-membership.md b/docs/examples/1.7.x/server-php/examples/teams/create-membership.md new file mode 100644 index 0000000000..285368f9dd --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/create-membership.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->createMembership( + teamId: '<TEAM_ID>', + roles: [], + email: 'email@example.com', // optional + userId: '<USER_ID>', // optional + phone: '+12065550100', // optional + url: 'https://example.com', // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/create.md b/docs/examples/1.7.x/server-php/examples/teams/create.md new file mode 100644 index 0000000000..643fa0eb11 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/create.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->create( + teamId: '<TEAM_ID>', + name: '<NAME>', + roles: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-php/examples/teams/delete-membership.md new file mode 100644 index 0000000000..579b790c55 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/delete-membership.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->deleteMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/delete.md b/docs/examples/1.7.x/server-php/examples/teams/delete.md new file mode 100644 index 0000000000..9db4e7e9a7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->delete( + teamId: '<TEAM_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/get-membership.md b/docs/examples/1.7.x/server-php/examples/teams/get-membership.md new file mode 100644 index 0000000000..bd6cbe8b42 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/get-membership.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->getMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-php/examples/teams/get-prefs.md new file mode 100644 index 0000000000..fbade4fc2f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/get-prefs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->getPrefs( + teamId: '<TEAM_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/get.md b/docs/examples/1.7.x/server-php/examples/teams/get.md new file mode 100644 index 0000000000..0dafa8a5d3 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->get( + teamId: '<TEAM_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-php/examples/teams/list-memberships.md new file mode 100644 index 0000000000..817ea7fefc --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/list-memberships.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->listMemberships( + teamId: '<TEAM_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/list.md b/docs/examples/1.7.x/server-php/examples/teams/list.md new file mode 100644 index 0000000000..99d9895fe5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/list.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->list( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-php/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..5dbfd4cb0f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/update-membership-status.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->updateMembershipStatus( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + userId: '<USER_ID>', + secret: '<SECRET>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/update-membership.md b/docs/examples/1.7.x/server-php/examples/teams/update-membership.md new file mode 100644 index 0000000000..10f135b01f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/update-membership.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->updateMembership( + teamId: '<TEAM_ID>', + membershipId: '<MEMBERSHIP_ID>', + roles: [] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/update-name.md b/docs/examples/1.7.x/server-php/examples/teams/update-name.md new file mode 100644 index 0000000000..bc13d924e4 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/update-name.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->updateName( + teamId: '<TEAM_ID>', + name: '<NAME>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-php/examples/teams/update-prefs.md new file mode 100644 index 0000000000..bd8d9de32f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/teams/update-prefs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Teams; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setSession(''); // The user session to authenticate with + +$teams = new Teams($client); + +$result = $teams->updatePrefs( + teamId: '<TEAM_ID>', + prefs: [] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-php/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..e4f230217a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/tokens/create-file-token.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Tokens; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$tokens = new Tokens($client); + +$result = $tokens->createFileToken( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + expire: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/tokens/delete.md b/docs/examples/1.7.x/server-php/examples/tokens/delete.md new file mode 100644 index 0000000000..278be90b12 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/tokens/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Tokens; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$tokens = new Tokens($client); + +$result = $tokens->delete( + tokenId: '<TOKEN_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/tokens/get.md b/docs/examples/1.7.x/server-php/examples/tokens/get.md new file mode 100644 index 0000000000..e7b4e1081b --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/tokens/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Tokens; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$tokens = new Tokens($client); + +$result = $tokens->get( + tokenId: '<TOKEN_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/tokens/list.md b/docs/examples/1.7.x/server-php/examples/tokens/list.md new file mode 100644 index 0000000000..b89420bed1 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/tokens/list.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Tokens; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$tokens = new Tokens($client); + +$result = $tokens->list( + bucketId: '<BUCKET_ID>', + fileId: '<FILE_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/tokens/update.md b/docs/examples/1.7.x/server-php/examples/tokens/update.md new file mode 100644 index 0000000000..ea95322a43 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/tokens/update.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Tokens; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$tokens = new Tokens($client); + +$result = $tokens->update( + tokenId: '<TOKEN_ID>', + expire: '' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-php/examples/users/create-argon2user.md new file mode 100644 index 0000000000..a9166ef3b0 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-argon2user.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createArgon2User( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-php/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..c9fd81e43a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-bcrypt-user.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createBcryptUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-php/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..1c1c6d40bd --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-j-w-t.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createJWT( + userId: '<USER_ID>', + sessionId: '<SESSION_ID>', // optional + duration: 0 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-php/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..696cbbeb57 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-m-d5user.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createMD5User( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-php/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..372fb1bc6a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createMfaRecoveryCodes( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-php/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..d56c4651f6 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-p-h-pass-user.md @@ -0,0 +1,18 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createPHPassUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-php/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..0b9a27ed8e --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-s-h-a-user.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createSHAUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordVersion: PasswordHash::SHA1(), // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-php/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..f579efb5f2 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createScryptModifiedUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordSaltSeparator: '<PASSWORD_SALT_SEPARATOR>', + passwordSignerKey: '<PASSWORD_SIGNER_KEY>', + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-php/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..b406b9404a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-scrypt-user.md @@ -0,0 +1,23 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createScryptUser( + userId: '<USER_ID>', + email: 'email@example.com', + password: 'password', + passwordSalt: '<PASSWORD_SALT>', + passwordCpu: null, + passwordMemory: null, + passwordParallel: null, + passwordLength: null, + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-session.md b/docs/examples/1.7.x/server-php/examples/users/create-session.md new file mode 100644 index 0000000000..1589315f92 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-session.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createSession( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-target.md b/docs/examples/1.7.x/server-php/examples/users/create-target.md new file mode 100644 index 0000000000..57946a440f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-target.md @@ -0,0 +1,21 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; +use Appwrite\Enums\MessagingProviderType; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + providerType: MessagingProviderType::EMAIL(), + identifier: '<IDENTIFIER>', + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create-token.md b/docs/examples/1.7.x/server-php/examples/users/create-token.md new file mode 100644 index 0000000000..1b92f5171d --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create-token.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->createToken( + userId: '<USER_ID>', + length: 4, // optional + expire: 60 // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/create.md b/docs/examples/1.7.x/server-php/examples/users/create.md new file mode 100644 index 0000000000..595f24fbce --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/create.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->create( + userId: '<USER_ID>', + email: 'email@example.com', // optional + phone: '+12065550100', // optional + password: '', // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/delete-identity.md b/docs/examples/1.7.x/server-php/examples/users/delete-identity.md new file mode 100644 index 0000000000..26b71eead2 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/delete-identity.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteIdentity( + identityId: '<IDENTITY_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-php/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..8ef1279589 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; +use Appwrite\Enums\AuthenticatorType; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteMfaAuthenticator( + userId: '<USER_ID>', + type: AuthenticatorType::TOTP() +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/delete-session.md b/docs/examples/1.7.x/server-php/examples/users/delete-session.md new file mode 100644 index 0000000000..493cf53d2f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/delete-session.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteSession( + userId: '<USER_ID>', + sessionId: '<SESSION_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-php/examples/users/delete-sessions.md new file mode 100644 index 0000000000..cd6d11e1d7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/delete-sessions.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteSessions( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/delete-target.md b/docs/examples/1.7.x/server-php/examples/users/delete-target.md new file mode 100644 index 0000000000..0d85d3e4df --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/delete-target.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->deleteTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/delete.md b/docs/examples/1.7.x/server-php/examples/users/delete.md new file mode 100644 index 0000000000..883156ecd6 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/delete.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->delete( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-php/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..db090fb245 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->getMfaRecoveryCodes( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/get-prefs.md b/docs/examples/1.7.x/server-php/examples/users/get-prefs.md new file mode 100644 index 0000000000..5e99e14b52 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/get-prefs.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->getPrefs( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/get-target.md b/docs/examples/1.7.x/server-php/examples/users/get-target.md new file mode 100644 index 0000000000..31baf3c852 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/get-target.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->getTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/get.md b/docs/examples/1.7.x/server-php/examples/users/get.md new file mode 100644 index 0000000000..0ce39ae6e5 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/get.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->get( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/list-identities.md b/docs/examples/1.7.x/server-php/examples/users/list-identities.md new file mode 100644 index 0000000000..fd15b7b51a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/list-identities.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listIdentities( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/list-logs.md b/docs/examples/1.7.x/server-php/examples/users/list-logs.md new file mode 100644 index 0000000000..7aea2dc59a --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/list-logs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listLogs( + userId: '<USER_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/list-memberships.md b/docs/examples/1.7.x/server-php/examples/users/list-memberships.md new file mode 100644 index 0000000000..53c4b1b9cc --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/list-memberships.md @@ -0,0 +1,17 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listMemberships( + userId: '<USER_ID>', + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-php/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..6a0088c9bd --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/list-mfa-factors.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listMfaFactors( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/list-sessions.md b/docs/examples/1.7.x/server-php/examples/users/list-sessions.md new file mode 100644 index 0000000000..bdbd0e5e51 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/list-sessions.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listSessions( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/list-targets.md b/docs/examples/1.7.x/server-php/examples/users/list-targets.md new file mode 100644 index 0000000000..005d51a531 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/list-targets.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->listTargets( + userId: '<USER_ID>', + queries: [] // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/list.md b/docs/examples/1.7.x/server-php/examples/users/list.md new file mode 100644 index 0000000000..04217363f0 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/list.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->list( + queries: [], // optional + search: '<SEARCH>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-php/examples/users/update-email-verification.md new file mode 100644 index 0000000000..636f1d2404 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-email-verification.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateEmailVerification( + userId: '<USER_ID>', + emailVerification: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-email.md b/docs/examples/1.7.x/server-php/examples/users/update-email.md new file mode 100644 index 0000000000..21ec88b334 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-email.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateEmail( + userId: '<USER_ID>', + email: 'email@example.com' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-labels.md b/docs/examples/1.7.x/server-php/examples/users/update-labels.md new file mode 100644 index 0000000000..7d4ae5de50 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-labels.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateLabels( + userId: '<USER_ID>', + labels: [] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-php/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..75214de880 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,15 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateMfaRecoveryCodes( + userId: '<USER_ID>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-mfa.md b/docs/examples/1.7.x/server-php/examples/users/update-mfa.md new file mode 100644 index 0000000000..3eda496f1f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-mfa.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateMfa( + userId: '<USER_ID>', + mfa: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-name.md b/docs/examples/1.7.x/server-php/examples/users/update-name.md new file mode 100644 index 0000000000..09bb07cdd7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-name.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateName( + userId: '<USER_ID>', + name: '<NAME>' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-password.md b/docs/examples/1.7.x/server-php/examples/users/update-password.md new file mode 100644 index 0000000000..6d58605d5c --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-password.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updatePassword( + userId: '<USER_ID>', + password: '' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-php/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..019fb3f148 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-phone-verification.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updatePhoneVerification( + userId: '<USER_ID>', + phoneVerification: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-phone.md b/docs/examples/1.7.x/server-php/examples/users/update-phone.md new file mode 100644 index 0000000000..13bd41bfa8 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-phone.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updatePhone( + userId: '<USER_ID>', + number: '+12065550100' +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-prefs.md b/docs/examples/1.7.x/server-php/examples/users/update-prefs.md new file mode 100644 index 0000000000..9491239271 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-prefs.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updatePrefs( + userId: '<USER_ID>', + prefs: [] +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-status.md b/docs/examples/1.7.x/server-php/examples/users/update-status.md new file mode 100644 index 0000000000..f29dc95e2f --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-status.md @@ -0,0 +1,16 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateStatus( + userId: '<USER_ID>', + status: false +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-php/examples/users/update-target.md b/docs/examples/1.7.x/server-php/examples/users/update-target.md new file mode 100644 index 0000000000..00ad27b9a7 --- /dev/null +++ b/docs/examples/1.7.x/server-php/examples/users/update-target.md @@ -0,0 +1,19 @@ +<?php + +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = (new Client()) + ->setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint + ->setProject('<YOUR_PROJECT_ID>') // Your project ID + ->setKey('<YOUR_API_KEY>'); // Your secret API key + +$users = new Users($client); + +$result = $users->updateTarget( + userId: '<USER_ID>', + targetId: '<TARGET_ID>', + identifier: '<IDENTIFIER>', // optional + providerId: '<PROVIDER_ID>', // optional + name: '<NAME>' // optional +); \ No newline at end of file diff --git a/docs/examples/1.7.x/server-python/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-python/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..c3b7a87d27 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-anonymous-session.md @@ -0,0 +1,10 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create_anonymous_session() diff --git a/docs/examples/1.7.x/server-python/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-python/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..e831821a6c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-email-password-session.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create_email_password_session( + email = 'email@example.com', + password = 'password' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create-email-token.md b/docs/examples/1.7.x/server-python/examples/account/create-email-token.md new file mode 100644 index 0000000000..7ff4f6b8a9 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-email-token.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create_email_token( + user_id = '<USER_ID>', + email = 'email@example.com', + phrase = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-python/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..172f45f996 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-j-w-t.md @@ -0,0 +1,10 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create_jwt() diff --git a/docs/examples/1.7.x/server-python/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-python/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..14e76ed4d3 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create_magic_url_token( + user_id = '<USER_ID>', + email = 'email@example.com', + url = 'https://example.com', # optional + phrase = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-python/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..70cee1d60c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-mfa-authenticator.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account +from appwrite.enums import AuthenticatorType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.create_mfa_authenticator( + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-python/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..abd746c605 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-mfa-challenge.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account +from appwrite.enums import AuthenticationFactor + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create_mfa_challenge( + factor = AuthenticationFactor.EMAIL +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-python/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..69aaa6091f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.create_mfa_recovery_codes() diff --git a/docs/examples/1.7.x/server-python/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-python/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..2dc171bb31 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-o-auth2token.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.account import Account +from appwrite.enums import OAuthProvider + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create_o_auth2_token( + provider = OAuthProvider.AMAZON, + success = 'https://example.com', # optional + failure = 'https://example.com', # optional + scopes = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-python/examples/account/create-phone-token.md new file mode 100644 index 0000000000..06c2b20414 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-phone-token.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create_phone_token( + user_id = '<USER_ID>', + phone = '+12065550100' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-python/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..c130646bee --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-phone-verification.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.create_phone_verification() diff --git a/docs/examples/1.7.x/server-python/examples/account/create-recovery.md b/docs/examples/1.7.x/server-python/examples/account/create-recovery.md new file mode 100644 index 0000000000..51c1777245 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-recovery.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.create_recovery( + email = 'email@example.com', + url = 'https://example.com' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create-session.md b/docs/examples/1.7.x/server-python/examples/account/create-session.md new file mode 100644 index 0000000000..1048dfedb2 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-session.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create_session( + user_id = '<USER_ID>', + secret = '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create-verification.md b/docs/examples/1.7.x/server-python/examples/account/create-verification.md new file mode 100644 index 0000000000..d66fc2cd7d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create-verification.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.create_verification( + url = 'https://example.com' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/create.md b/docs/examples/1.7.x/server-python/examples/account/create.md new file mode 100644 index 0000000000..7eda5a37fe --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/create.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.create( + user_id = '<USER_ID>', + email = 'email@example.com', + password = '', + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/account/delete-identity.md b/docs/examples/1.7.x/server-python/examples/account/delete-identity.md new file mode 100644 index 0000000000..0c894fa693 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/delete-identity.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.delete_identity( + identity_id = '<IDENTITY_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-python/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..83709c7aff --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account +from appwrite.enums import AuthenticatorType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.delete_mfa_authenticator( + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/1.7.x/server-python/examples/account/delete-session.md b/docs/examples/1.7.x/server-python/examples/account/delete-session.md new file mode 100644 index 0000000000..5967d7026a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/delete-session.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.delete_session( + session_id = '<SESSION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-python/examples/account/delete-sessions.md new file mode 100644 index 0000000000..5061f84c5d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/delete-sessions.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.delete_sessions() diff --git a/docs/examples/1.7.x/server-python/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-python/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..c8fe494d0f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.get_mfa_recovery_codes() diff --git a/docs/examples/1.7.x/server-python/examples/account/get-prefs.md b/docs/examples/1.7.x/server-python/examples/account/get-prefs.md new file mode 100644 index 0000000000..d577b4b274 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/get-prefs.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.get_prefs() diff --git a/docs/examples/1.7.x/server-python/examples/account/get-session.md b/docs/examples/1.7.x/server-python/examples/account/get-session.md new file mode 100644 index 0000000000..3e2937b913 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/get-session.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.get_session( + session_id = '<SESSION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/get.md b/docs/examples/1.7.x/server-python/examples/account/get.md new file mode 100644 index 0000000000..542622851c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/get.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.get() diff --git a/docs/examples/1.7.x/server-python/examples/account/list-identities.md b/docs/examples/1.7.x/server-python/examples/account/list-identities.md new file mode 100644 index 0000000000..aeb23be747 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/list-identities.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.list_identities( + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/account/list-logs.md b/docs/examples/1.7.x/server-python/examples/account/list-logs.md new file mode 100644 index 0000000000..67d193d186 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/list-logs.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.list_logs( + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-python/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..72a392465a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/list-mfa-factors.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.list_mfa_factors() diff --git a/docs/examples/1.7.x/server-python/examples/account/list-sessions.md b/docs/examples/1.7.x/server-python/examples/account/list-sessions.md new file mode 100644 index 0000000000..c553a7bce2 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/list-sessions.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.list_sessions() diff --git a/docs/examples/1.7.x/server-python/examples/account/update-email.md b/docs/examples/1.7.x/server-python/examples/account/update-email.md new file mode 100644 index 0000000000..14de4fd41e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-email.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_email( + email = 'email@example.com', + password = 'password' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-python/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..7083d09642 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-m-f-a.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_mfa( + mfa = False +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-python/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..0146083030 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.update_magic_url_session( + user_id = '<USER_ID>', + secret = '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-python/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..d53607fe10 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-mfa-authenticator.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.account import Account +from appwrite.enums import AuthenticatorType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_mfa_authenticator( + type = AuthenticatorType.TOTP, + otp = '<OTP>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-python/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..cfc58c58a2 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-mfa-challenge.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_mfa_challenge( + challenge_id = '<CHALLENGE_ID>', + otp = '<OTP>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-python/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..51718eb03a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_mfa_recovery_codes() diff --git a/docs/examples/1.7.x/server-python/examples/account/update-name.md b/docs/examples/1.7.x/server-python/examples/account/update-name.md new file mode 100644 index 0000000000..534a94e8bb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-name.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_name( + name = '<NAME>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-password.md b/docs/examples/1.7.x/server-python/examples/account/update-password.md new file mode 100644 index 0000000000..3c072e32d7 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-password.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_password( + password = '', + old_password = 'password' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-python/examples/account/update-phone-session.md new file mode 100644 index 0000000000..52e77233a6 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-phone-session.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account(client) + +result = account.update_phone_session( + user_id = '<USER_ID>', + secret = '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-python/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..bcc57dee71 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-phone-verification.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_phone_verification( + user_id = '<USER_ID>', + secret = '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-phone.md b/docs/examples/1.7.x/server-python/examples/account/update-phone.md new file mode 100644 index 0000000000..a2cb7d3c83 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-phone.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_phone( + phone = '+12065550100', + password = 'password' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-prefs.md b/docs/examples/1.7.x/server-python/examples/account/update-prefs.md new file mode 100644 index 0000000000..e2ac7a28c1 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-prefs.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_prefs( + prefs = {} +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-recovery.md b/docs/examples/1.7.x/server-python/examples/account/update-recovery.md new file mode 100644 index 0000000000..ed140abc0f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-recovery.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_recovery( + user_id = '<USER_ID>', + secret = '<SECRET>', + password = '' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-session.md b/docs/examples/1.7.x/server-python/examples/account/update-session.md new file mode 100644 index 0000000000..abee773edc --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-session.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_session( + session_id = '<SESSION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/account/update-status.md b/docs/examples/1.7.x/server-python/examples/account/update-status.md new file mode 100644 index 0000000000..a5272f09de --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-status.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_status() diff --git a/docs/examples/1.7.x/server-python/examples/account/update-verification.md b/docs/examples/1.7.x/server-python/examples/account/update-verification.md new file mode 100644 index 0000000000..fbc7af5302 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/account/update-verification.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.account import Account + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +account = Account(client) + +result = account.update_verification( + user_id = '<USER_ID>', + secret = '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-python/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-python/examples/avatars/get-browser.md new file mode 100644 index 0000000000..ff11b8b46f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/avatars/get-browser.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars +from appwrite.enums import Browser + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +avatars = Avatars(client) + +result = avatars.get_browser( + code = Browser.AVANT_BROWSER, + width = 0, # optional + height = 0, # optional + quality = -1 # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-python/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..286f4d346c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/avatars/get-credit-card.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars +from appwrite.enums import CreditCard + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +avatars = Avatars(client) + +result = avatars.get_credit_card( + code = CreditCard.AMERICAN_EXPRESS, + width = 0, # optional + height = 0, # optional + quality = -1 # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-python/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..f034ea41f3 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/avatars/get-favicon.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +avatars = Avatars(client) + +result = avatars.get_favicon( + url = 'https://example.com' +) diff --git a/docs/examples/1.7.x/server-python/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-python/examples/avatars/get-flag.md new file mode 100644 index 0000000000..6365a78b47 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/avatars/get-flag.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars +from appwrite.enums import Flag + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +avatars = Avatars(client) + +result = avatars.get_flag( + code = Flag.AFGHANISTAN, + width = 0, # optional + height = 0, # optional + quality = -1 # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/avatars/get-image.md b/docs/examples/1.7.x/server-python/examples/avatars/get-image.md new file mode 100644 index 0000000000..9272c4d8fb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/avatars/get-image.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +avatars = Avatars(client) + +result = avatars.get_image( + url = 'https://example.com', + width = 0, # optional + height = 0 # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-python/examples/avatars/get-initials.md new file mode 100644 index 0000000000..2729ff5133 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +avatars = Avatars(client) + +result = avatars.get_initials( + name = '<NAME>', # optional + width = 0, # optional + height = 0, # optional + background = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-python/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..3fb76a7f7c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/avatars/get-q-r.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +avatars = Avatars(client) + +result = avatars.get_qr( + text = '<TEXT>', + size = 1, # optional + margin = 0, # optional + download = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..f12f446d30 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-boolean-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_boolean_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = False, # optional + array = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-collection.md b/docs/examples/1.7.x/server-python/examples/databases/create-collection.md new file mode 100644 index 0000000000..596d4a9383 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-collection.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_collection( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + name = '<NAME>', + permissions = ["read("any")"], # optional + document_security = False, # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..8fd59e694f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-datetime-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_datetime_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = '', # optional + array = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-document.md b/docs/examples/1.7.x/server-python/examples/databases/create-document.md new file mode 100644 index 0000000000..1a8500b0f2 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-document.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_session('') # The user session to authenticate with +client.set_key('<YOUR_API_KEY>') # Your secret API key +client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token + +databases = Databases(client) + +result = databases.create_document( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + document_id = '<DOCUMENT_ID>', + data = {}, + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-documents.md b/docs/examples/1.7.x/server-python/examples/databases/create-documents.md new file mode 100644 index 0000000000..7c6ef24bdb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-documents.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_documents( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + documents = [] +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..230567aa46 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-email-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_email_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = 'email@example.com', # optional + array = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..de1ceb9f1f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-enum-attribute.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_enum_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + elements = [], + required = False, + default = '<DEFAULT>', # optional + array = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..53305c8d4e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-float-attribute.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_float_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + min = None, # optional + max = None, # optional + default = None, # optional + array = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-index.md b/docs/examples/1.7.x/server-python/examples/databases/create-index.md new file mode 100644 index 0000000000..f7bb455d07 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-index.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases +from appwrite.enums import IndexType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_index( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + type = IndexType.KEY, + attributes = [], + orders = [], # optional + lengths = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..92e8b0f86a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-integer-attribute.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_integer_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + min = None, # optional + max = None, # optional + default = None, # optional + array = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..a7f424b22c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-ip-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_ip_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = '', # optional + array = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..6c8f4dc5bb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-relationship-attribute.md @@ -0,0 +1,21 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases +from appwrite.enums import RelationshipType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_relationship_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + related_collection_id = '<RELATED_COLLECTION_ID>', + type = RelationshipType.ONETOONE, + two_way = False, # optional + key = '', # optional + two_way_key = '', # optional + on_delete = RelationMutate.CASCADE # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..dc434cccaf --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-string-attribute.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_string_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + size = 1, + required = False, + default = '<DEFAULT>', # optional + array = False, # optional + encrypt = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..af375733dd --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create-url-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create_url_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = 'https://example.com', # optional + array = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/create.md b/docs/examples/1.7.x/server-python/examples/databases/create.md new file mode 100644 index 0000000000..0492203e4c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/create.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.create( + database_id = '<DATABASE_ID>', + name = '<NAME>', + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..e1c4eecd01 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/delete-attribute.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.delete_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '' +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-python/examples/databases/delete-collection.md new file mode 100644 index 0000000000..02f1e1c536 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/delete-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.delete_collection( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/delete-document.md b/docs/examples/1.7.x/server-python/examples/databases/delete-document.md new file mode 100644 index 0000000000..57f8b3bd9d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/delete-document.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +databases = Databases(client) + +result = databases.delete_document( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + document_id = '<DOCUMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-python/examples/databases/delete-documents.md new file mode 100644 index 0000000000..a315f0c200 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/delete-documents.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.delete_documents( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/delete-index.md b/docs/examples/1.7.x/server-python/examples/databases/delete-index.md new file mode 100644 index 0000000000..006006421d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/delete-index.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.delete_index( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '' +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/delete.md b/docs/examples/1.7.x/server-python/examples/databases/delete.md new file mode 100644 index 0000000000..be64e8c628 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.delete( + database_id = '<DATABASE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/get-attribute.md new file mode 100644 index 0000000000..dcdb0a6ea9 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/get-attribute.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.get_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '' +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/get-collection.md b/docs/examples/1.7.x/server-python/examples/databases/get-collection.md new file mode 100644 index 0000000000..0833b4fd7e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/get-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.get_collection( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/get-document.md b/docs/examples/1.7.x/server-python/examples/databases/get-document.md new file mode 100644 index 0000000000..aff5008fa0 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/get-document.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +databases = Databases(client) + +result = databases.get_document( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + document_id = '<DOCUMENT_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/get-index.md b/docs/examples/1.7.x/server-python/examples/databases/get-index.md new file mode 100644 index 0000000000..6971683072 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/get-index.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.get_index( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '' +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/get.md b/docs/examples/1.7.x/server-python/examples/databases/get.md new file mode 100644 index 0000000000..c8191a3777 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.get( + database_id = '<DATABASE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-python/examples/databases/list-attributes.md new file mode 100644 index 0000000000..c97a5ced64 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/list-attributes.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.list_attributes( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/list-collections.md b/docs/examples/1.7.x/server-python/examples/databases/list-collections.md new file mode 100644 index 0000000000..17d0a3d878 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/list-collections.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.list_collections( + database_id = '<DATABASE_ID>', + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/list-documents.md b/docs/examples/1.7.x/server-python/examples/databases/list-documents.md new file mode 100644 index 0000000000..8b450cd020 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/list-documents.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +databases = Databases(client) + +result = databases.list_documents( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-python/examples/databases/list-indexes.md new file mode 100644 index 0000000000..1457151a4e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/list-indexes.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.list_indexes( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/list.md b/docs/examples/1.7.x/server-python/examples/databases/list.md new file mode 100644 index 0000000000..58336c9f89 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.list( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..a0f72a49fb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-boolean-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_boolean_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = False, + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-collection.md b/docs/examples/1.7.x/server-python/examples/databases/update-collection.md new file mode 100644 index 0000000000..2e5be50581 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-collection.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_collection( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + name = '<NAME>', + permissions = ["read("any")"], # optional + document_security = False, # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..29bc6be4d1 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-datetime-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_datetime_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = '', + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-document.md b/docs/examples/1.7.x/server-python/examples/databases/update-document.md new file mode 100644 index 0000000000..9ef6527934 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-document.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +databases = Databases(client) + +result = databases.update_document( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + document_id = '<DOCUMENT_ID>', + data = {}, # optional + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-documents.md b/docs/examples/1.7.x/server-python/examples/databases/update-documents.md new file mode 100644 index 0000000000..5a50d1a912 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-documents.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_documents( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + data = {}, # optional + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..c833789a37 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-email-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_email_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = 'email@example.com', + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..6186a72a66 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-enum-attribute.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_enum_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + elements = [], + required = False, + default = '<DEFAULT>', + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..68cb7d7929 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-float-attribute.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_float_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = None, + min = None, # optional + max = None, # optional + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..05c6bfe915 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-integer-attribute.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_integer_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = None, + min = None, # optional + max = None, # optional + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..550d3af641 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-ip-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_ip_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = '', + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..3b6c8e93e9 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-relationship-attribute.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_relationship_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + on_delete = RelationMutate.CASCADE, # optional + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..5b66fb015c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-string-attribute.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_string_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = '<DEFAULT>', + size = 1, # optional + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-python/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..4a6202760f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update-url-attribute.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update_url_attribute( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + key = '', + required = False, + default = 'https://example.com', + new_key = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/update.md b/docs/examples/1.7.x/server-python/examples/databases/update.md new file mode 100644 index 0000000000..35d2c0cc40 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/update.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.update( + database_id = '<DATABASE_ID>', + name = '<NAME>', + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-python/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..99720649d6 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/databases/upsert-documents.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.databases import Databases + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases(client) + +result = databases.upsert_documents( + database_id = '<DATABASE_ID>', + collection_id = '<COLLECTION_ID>', + documents = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-python/examples/functions/create-deployment.md new file mode 100644 index 0000000000..0774005729 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/create-deployment.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions +from appwrite.input_file import InputFile + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.create_deployment( + function_id = '<FUNCTION_ID>', + code = InputFile.from_path('file.png'), + activate = False, + entrypoint = '<ENTRYPOINT>', # optional + commands = '<COMMANDS>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-python/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..79315e4a1c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.create_duplicate_deployment( + function_id = '<FUNCTION_ID>', + deployment_id = '<DEPLOYMENT_ID>', + build_id = '<BUILD_ID>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/create-execution.md b/docs/examples/1.7.x/server-python/examples/functions/create-execution.md new file mode 100644 index 0000000000..b41c7e376c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/create-execution.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +functions = Functions(client) + +result = functions.create_execution( + function_id = '<FUNCTION_ID>', + body = '<BODY>', # optional + async = False, # optional + path = '<PATH>', # optional + method = ExecutionMethod.GET, # optional + headers = {}, # optional + scheduled_at = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-python/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..6083cc1cb3 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/create-template-deployment.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.create_template_deployment( + function_id = '<FUNCTION_ID>', + repository = '<REPOSITORY>', + owner = '<OWNER>', + root_directory = '<ROOT_DIRECTORY>', + version = '<VERSION>', + activate = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/create-variable.md b/docs/examples/1.7.x/server-python/examples/functions/create-variable.md new file mode 100644 index 0000000000..2089830eff --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/create-variable.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.create_variable( + function_id = '<FUNCTION_ID>', + key = '<KEY>', + value = '<VALUE>', + secret = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-python/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..4004baec27 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/create-vcs-deployment.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions +from appwrite.enums import VCSDeploymentType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.create_vcs_deployment( + function_id = '<FUNCTION_ID>', + type = VCSDeploymentType.BRANCH, + reference = '<REFERENCE>', + activate = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/create.md b/docs/examples/1.7.x/server-python/examples/functions/create.md new file mode 100644 index 0000000000..8758e27e50 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/create.md @@ -0,0 +1,31 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions +from appwrite.enums import + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.create( + function_id = '<FUNCTION_ID>', + name = '<NAME>', + runtime = .NODE_14_5, + execute = ["any"], # optional + events = [], # optional + schedule = '', # optional + timeout = 1, # optional + enabled = False, # optional + logging = False, # optional + entrypoint = '<ENTRYPOINT>', # optional + commands = '<COMMANDS>', # optional + scopes = [], # optional + installation_id = '<INSTALLATION_ID>', # optional + provider_repository_id = '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch = '<PROVIDER_BRANCH>', # optional + provider_silent_mode = False, # optional + provider_root_directory = '<PROVIDER_ROOT_DIRECTORY>', # optional + specification = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-python/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..f874b2d270 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/delete-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.delete_deployment( + function_id = '<FUNCTION_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-python/examples/functions/delete-execution.md new file mode 100644 index 0000000000..df7ce7cb5b --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/delete-execution.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.delete_execution( + function_id = '<FUNCTION_ID>', + execution_id = '<EXECUTION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-python/examples/functions/delete-variable.md new file mode 100644 index 0000000000..a6e3dc853c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/delete-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.delete_variable( + function_id = '<FUNCTION_ID>', + variable_id = '<VARIABLE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/delete.md b/docs/examples/1.7.x/server-python/examples/functions/delete.md new file mode 100644 index 0000000000..ed2fef76c7 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.delete( + function_id = '<FUNCTION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-python/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..1b0673c468 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/get-deployment-download.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.get_deployment_download( + function_id = '<FUNCTION_ID>', + deployment_id = '<DEPLOYMENT_ID>', + type = DeploymentDownloadType.SOURCE # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-python/examples/functions/get-deployment.md new file mode 100644 index 0000000000..59a1374e0f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/get-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.get_deployment( + function_id = '<FUNCTION_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/get-execution.md b/docs/examples/1.7.x/server-python/examples/functions/get-execution.md new file mode 100644 index 0000000000..a299f35195 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/get-execution.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +functions = Functions(client) + +result = functions.get_execution( + function_id = '<FUNCTION_ID>', + execution_id = '<EXECUTION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/get-variable.md b/docs/examples/1.7.x/server-python/examples/functions/get-variable.md new file mode 100644 index 0000000000..629948e909 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/get-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.get_variable( + function_id = '<FUNCTION_ID>', + variable_id = '<VARIABLE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/get.md b/docs/examples/1.7.x/server-python/examples/functions/get.md new file mode 100644 index 0000000000..eeab5a556b --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.get( + function_id = '<FUNCTION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-python/examples/functions/list-deployments.md new file mode 100644 index 0000000000..4eb92f60df --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/list-deployments.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.list_deployments( + function_id = '<FUNCTION_ID>', + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/list-executions.md b/docs/examples/1.7.x/server-python/examples/functions/list-executions.md new file mode 100644 index 0000000000..300fc0e51d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/list-executions.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +functions = Functions(client) + +result = functions.list_executions( + function_id = '<FUNCTION_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-python/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..9c89a36f0c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/list-runtimes.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.list_runtimes() diff --git a/docs/examples/1.7.x/server-python/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-python/examples/functions/list-specifications.md new file mode 100644 index 0000000000..d7d0036d35 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/list-specifications.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.list_specifications() diff --git a/docs/examples/1.7.x/server-python/examples/functions/list-variables.md b/docs/examples/1.7.x/server-python/examples/functions/list-variables.md new file mode 100644 index 0000000000..ebc19c5ba4 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/list-variables.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.list_variables( + function_id = '<FUNCTION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/list.md b/docs/examples/1.7.x/server-python/examples/functions/list.md new file mode 100644 index 0000000000..b1d696d25a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.list( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-python/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..6c6a8bf121 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/update-deployment-status.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.update_deployment_status( + function_id = '<FUNCTION_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-python/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..da14309177 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/update-function-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.update_function_deployment( + function_id = '<FUNCTION_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/update-variable.md b/docs/examples/1.7.x/server-python/examples/functions/update-variable.md new file mode 100644 index 0000000000..f8bcc0376c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/update-variable.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.update_variable( + function_id = '<FUNCTION_ID>', + variable_id = '<VARIABLE_ID>', + key = '<KEY>', + value = '<VALUE>', # optional + secret = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/functions/update.md b/docs/examples/1.7.x/server-python/examples/functions/update.md new file mode 100644 index 0000000000..64ee39b29d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/functions/update.md @@ -0,0 +1,30 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions(client) + +result = functions.update( + function_id = '<FUNCTION_ID>', + name = '<NAME>', + runtime = .NODE_14_5, # optional + execute = ["any"], # optional + events = [], # optional + schedule = '', # optional + timeout = 1, # optional + enabled = False, # optional + logging = False, # optional + entrypoint = '<ENTRYPOINT>', # optional + commands = '<COMMANDS>', # optional + scopes = [], # optional + installation_id = '<INSTALLATION_ID>', # optional + provider_repository_id = '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch = '<PROVIDER_BRANCH>', # optional + provider_silent_mode = False, # optional + provider_root_directory = '<PROVIDER_ROOT_DIRECTORY>', # optional + specification = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/graphql/mutation.md b/docs/examples/1.7.x/server-python/examples/graphql/mutation.md new file mode 100644 index 0000000000..189892a4ad --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/graphql/mutation.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.graphql import Graphql + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +graphql = Graphql(client) + +result = graphql.mutation( + query = {} +) diff --git a/docs/examples/1.7.x/server-python/examples/graphql/query.md b/docs/examples/1.7.x/server-python/examples/graphql/query.md new file mode 100644 index 0000000000..585a5029b5 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/graphql/query.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.graphql import Graphql + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +graphql = Graphql(client) + +result = graphql.query( + query = {} +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-python/examples/health/get-antivirus.md new file mode 100644 index 0000000000..2b621472ee --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-antivirus.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_antivirus() diff --git a/docs/examples/1.7.x/server-python/examples/health/get-cache.md b/docs/examples/1.7.x/server-python/examples/health/get-cache.md new file mode 100644 index 0000000000..595c4bf0a5 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-cache.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_cache() diff --git a/docs/examples/1.7.x/server-python/examples/health/get-certificate.md b/docs/examples/1.7.x/server-python/examples/health/get-certificate.md new file mode 100644 index 0000000000..5b3e2c0ad3 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-certificate.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_certificate( + domain = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-d-b.md b/docs/examples/1.7.x/server-python/examples/health/get-d-b.md new file mode 100644 index 0000000000..47c7bd8efb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-d-b.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_db() diff --git a/docs/examples/1.7.x/server-python/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-python/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..5362a2d02a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-failed-jobs.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.health import Health +from appwrite.enums import + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_failed_jobs( + name = .V1_DATABASE, + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-python/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..e5115d06b8 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-pub-sub.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_pub_sub() diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..18ed8e3023 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-builds.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_builds( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..b0a29e2d5b --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-certificates.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_certificates( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..491d1f7c35 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-databases.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_databases( + name = '<NAME>', # optional + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..fa860c6111 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-deletes.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_deletes( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..d4ca9388d9 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-functions.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_functions( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..1479f03634 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-logs.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_logs( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..6835efeaa4 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-mails.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_mails( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..34cbad2f31 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-messaging.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_messaging( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..019db4e811 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-migrations.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_migrations( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..92aebc3c91 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-stats-resources.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_stats_resources( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..266ca828b1 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-usage.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_usage( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-python/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..df5e2d56db --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-queue-webhooks.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_queue_webhooks( + threshold = None # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-python/examples/health/get-storage-local.md new file mode 100644 index 0000000000..7d2ea44f45 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-storage-local.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_storage_local() diff --git a/docs/examples/1.7.x/server-python/examples/health/get-storage.md b/docs/examples/1.7.x/server-python/examples/health/get-storage.md new file mode 100644 index 0000000000..821d9f3986 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-storage.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_storage() diff --git a/docs/examples/1.7.x/server-python/examples/health/get-time.md b/docs/examples/1.7.x/server-python/examples/health/get-time.md new file mode 100644 index 0000000000..907e96499b --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get-time.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get_time() diff --git a/docs/examples/1.7.x/server-python/examples/health/get.md b/docs/examples/1.7.x/server-python/examples/health/get.md new file mode 100644 index 0000000000..c544fcc9b6 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/health/get.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health(client) + +result = health.get() diff --git a/docs/examples/1.7.x/server-python/examples/locale/get.md b/docs/examples/1.7.x/server-python/examples/locale/get.md new file mode 100644 index 0000000000..6f2a877b0c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/locale/get.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +locale = Locale(client) + +result = locale.get() diff --git a/docs/examples/1.7.x/server-python/examples/locale/list-codes.md b/docs/examples/1.7.x/server-python/examples/locale/list-codes.md new file mode 100644 index 0000000000..5f3e501fe1 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/locale/list-codes.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +locale = Locale(client) + +result = locale.list_codes() diff --git a/docs/examples/1.7.x/server-python/examples/locale/list-continents.md b/docs/examples/1.7.x/server-python/examples/locale/list-continents.md new file mode 100644 index 0000000000..0aead81734 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/locale/list-continents.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +locale = Locale(client) + +result = locale.list_continents() diff --git a/docs/examples/1.7.x/server-python/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-python/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..f88e331f43 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/locale/list-countries-e-u.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +locale = Locale(client) + +result = locale.list_countries_eu() diff --git a/docs/examples/1.7.x/server-python/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-python/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..b1fdc1ae51 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/locale/list-countries-phones.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +locale = Locale(client) + +result = locale.list_countries_phones() diff --git a/docs/examples/1.7.x/server-python/examples/locale/list-countries.md b/docs/examples/1.7.x/server-python/examples/locale/list-countries.md new file mode 100644 index 0000000000..0c5b23cdd1 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/locale/list-countries.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +locale = Locale(client) + +result = locale.list_countries() diff --git a/docs/examples/1.7.x/server-python/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-python/examples/locale/list-currencies.md new file mode 100644 index 0000000000..20009d6569 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/locale/list-currencies.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +locale = Locale(client) + +result = locale.list_currencies() diff --git a/docs/examples/1.7.x/server-python/examples/locale/list-languages.md b/docs/examples/1.7.x/server-python/examples/locale/list-languages.md new file mode 100644 index 0000000000..1962a8399e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/locale/list-languages.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +locale = Locale(client) + +result = locale.list_languages() diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..b57fa00f23 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-apns-provider.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_apns_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + auth_key = '<AUTH_KEY>', # optional + auth_key_id = '<AUTH_KEY_ID>', # optional + team_id = '<TEAM_ID>', # optional + bundle_id = '<BUNDLE_ID>', # optional + sandbox = False, # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-email.md b/docs/examples/1.7.x/server-python/examples/messaging/create-email.md new file mode 100644 index 0000000000..8b4c9d267e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-email.md @@ -0,0 +1,24 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_email( + message_id = '<MESSAGE_ID>', + subject = '<SUBJECT>', + content = '<CONTENT>', + topics = [], # optional + users = [], # optional + targets = [], # optional + cc = [], # optional + bcc = [], # optional + attachments = [], # optional + draft = False, # optional + html = False, # optional + scheduled_at = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..9c40eb7828 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-fcm-provider.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_fcm_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + service_account_json = {}, # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..6703f6fdcc --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,22 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_mailgun_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + api_key = '<API_KEY>', # optional + domain = '<DOMAIN>', # optional + is_eu_region = False, # optional + from_name = '<FROM_NAME>', # optional + from_email = 'email@example.com', # optional + reply_to_name = '<REPLY_TO_NAME>', # optional + reply_to_email = 'email@example.com', # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..9315dcdd30 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-msg91provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_msg91_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + template_id = '<TEMPLATE_ID>', # optional + sender_id = '<SENDER_ID>', # optional + auth_key = '<AUTH_KEY>', # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-push.md b/docs/examples/1.7.x/server-python/examples/messaging/create-push.md new file mode 100644 index 0000000000..8671b56a39 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-push.md @@ -0,0 +1,31 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_push( + message_id = '<MESSAGE_ID>', + title = '<TITLE>', # optional + body = '<BODY>', # optional + topics = [], # optional + users = [], # optional + targets = [], # optional + data = {}, # optional + action = '<ACTION>', # optional + image = '[ID1:ID2]', # optional + icon = '<ICON>', # optional + sound = '<SOUND>', # optional + color = '<COLOR>', # optional + tag = '<TAG>', # optional + badge = None, # optional + draft = False, # optional + scheduled_at = '', # optional + content_available = False, # optional + critical = False, # optional + priority = MessagePriority.NORMAL # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..46ff54f166 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_sendgrid_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + api_key = '<API_KEY>', # optional + from_name = '<FROM_NAME>', # optional + from_email = 'email@example.com', # optional + reply_to_name = '<REPLY_TO_NAME>', # optional + reply_to_email = 'email@example.com', # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-python/examples/messaging/create-sms.md new file mode 100644 index 0000000000..d1c7b495b2 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-sms.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_sms( + message_id = '<MESSAGE_ID>', + content = '<CONTENT>', + topics = [], # optional + users = [], # optional + targets = [], # optional + draft = False, # optional + scheduled_at = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..99914f0779 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-smtp-provider.md @@ -0,0 +1,26 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_smtp_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + host = '<HOST>', + port = 1, # optional + username = '<USERNAME>', # optional + password = '<PASSWORD>', # optional + encryption = SmtpEncryption.NONE, # optional + auto_tls = False, # optional + mailer = '<MAILER>', # optional + from_name = '<FROM_NAME>', # optional + from_email = 'email@example.com', # optional + reply_to_name = '<REPLY_TO_NAME>', # optional + reply_to_email = 'email@example.com', # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-python/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..bc0c892b48 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-subscriber.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token + +messaging = Messaging(client) + +result = messaging.create_subscriber( + topic_id = '<TOPIC_ID>', + subscriber_id = '<SUBSCRIBER_ID>', + target_id = '<TARGET_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..aff09fe852 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-telesign-provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_telesign_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + from = '+12065550100', # optional + customer_id = '<CUSTOMER_ID>', # optional + api_key = '<API_KEY>', # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..46ded71cdd --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_textmagic_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + from = '+12065550100', # optional + username = '<USERNAME>', # optional + api_key = '<API_KEY>', # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-python/examples/messaging/create-topic.md new file mode 100644 index 0000000000..c1cb465e9b --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-topic.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_topic( + topic_id = '<TOPIC_ID>', + name = '<NAME>', + subscribe = ["any"] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..4438563abf --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-twilio-provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_twilio_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + from = '+12065550100', # optional + account_sid = '<ACCOUNT_SID>', # optional + auth_token = '<AUTH_TOKEN>', # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..6ffded5b53 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/create-vonage-provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.create_vonage_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', + from = '+12065550100', # optional + api_key = '<API_KEY>', # optional + api_secret = '<API_SECRET>', # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..649e504c19 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/delete-provider.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.delete_provider( + provider_id = '<PROVIDER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-python/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..c012a9ac97 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/delete-subscriber.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_jwt('<YOUR_JWT>') # Your secret JSON Web Token + +messaging = Messaging(client) + +result = messaging.delete_subscriber( + topic_id = '<TOPIC_ID>', + subscriber_id = '<SUBSCRIBER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-python/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..76f9093a5f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/delete-topic.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.delete_topic( + topic_id = '<TOPIC_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/delete.md b/docs/examples/1.7.x/server-python/examples/messaging/delete.md new file mode 100644 index 0000000000..0153ac90cb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.delete( + message_id = '<MESSAGE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/get-message.md b/docs/examples/1.7.x/server-python/examples/messaging/get-message.md new file mode 100644 index 0000000000..3fadcff7d3 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/get-message.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.get_message( + message_id = '<MESSAGE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/get-provider.md new file mode 100644 index 0000000000..58e6228053 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/get-provider.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.get_provider( + provider_id = '<PROVIDER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-python/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..ca997f21f0 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/get-subscriber.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.get_subscriber( + topic_id = '<TOPIC_ID>', + subscriber_id = '<SUBSCRIBER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-python/examples/messaging/get-topic.md new file mode 100644 index 0000000000..c238a98afe --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/get-topic.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.get_topic( + topic_id = '<TOPIC_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-python/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..f28c3e506f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/list-message-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.list_message_logs( + message_id = '<MESSAGE_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-python/examples/messaging/list-messages.md new file mode 100644 index 0000000000..211649d5fb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/list-messages.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.list_messages( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-python/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..da87e5939b --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/list-provider-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.list_provider_logs( + provider_id = '<PROVIDER_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-python/examples/messaging/list-providers.md new file mode 100644 index 0000000000..03e5c4ebbc --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/list-providers.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.list_providers( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-python/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..df8ec72911 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.list_subscriber_logs( + subscriber_id = '<SUBSCRIBER_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-python/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..f949b408e5 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/list-subscribers.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.list_subscribers( + topic_id = '<TOPIC_ID>', + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-python/examples/messaging/list-targets.md new file mode 100644 index 0000000000..786ee42b19 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/list-targets.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.list_targets( + message_id = '<MESSAGE_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-python/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..f8a3995295 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/list-topic-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.list_topic_logs( + topic_id = '<TOPIC_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-python/examples/messaging/list-topics.md new file mode 100644 index 0000000000..1c2cefc9cd --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/list-topics.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.list_topics( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..f695b61b8c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-apns-provider.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_apns_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + enabled = False, # optional + auth_key = '<AUTH_KEY>', # optional + auth_key_id = '<AUTH_KEY_ID>', # optional + team_id = '<TEAM_ID>', # optional + bundle_id = '<BUNDLE_ID>', # optional + sandbox = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-email.md b/docs/examples/1.7.x/server-python/examples/messaging/update-email.md new file mode 100644 index 0000000000..5731d5f29a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-email.md @@ -0,0 +1,24 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_email( + message_id = '<MESSAGE_ID>', + topics = [], # optional + users = [], # optional + targets = [], # optional + subject = '<SUBJECT>', # optional + content = '<CONTENT>', # optional + draft = False, # optional + html = False, # optional + cc = [], # optional + bcc = [], # optional + scheduled_at = '', # optional + attachments = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..0119d71b4f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-fcm-provider.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_fcm_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + enabled = False, # optional + service_account_json = {} # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..039475ffdc --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,22 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_mailgun_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + api_key = '<API_KEY>', # optional + domain = '<DOMAIN>', # optional + is_eu_region = False, # optional + enabled = False, # optional + from_name = '<FROM_NAME>', # optional + from_email = 'email@example.com', # optional + reply_to_name = '<REPLY_TO_NAME>', # optional + reply_to_email = '<REPLY_TO_EMAIL>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..c5bd057912 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-msg91provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_msg91_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + enabled = False, # optional + template_id = '<TEMPLATE_ID>', # optional + sender_id = '<SENDER_ID>', # optional + auth_key = '<AUTH_KEY>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-push.md b/docs/examples/1.7.x/server-python/examples/messaging/update-push.md new file mode 100644 index 0000000000..e3bb02e71f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-push.md @@ -0,0 +1,31 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_push( + message_id = '<MESSAGE_ID>', + topics = [], # optional + users = [], # optional + targets = [], # optional + title = '<TITLE>', # optional + body = '<BODY>', # optional + data = {}, # optional + action = '<ACTION>', # optional + image = '[ID1:ID2]', # optional + icon = '<ICON>', # optional + sound = '<SOUND>', # optional + color = '<COLOR>', # optional + tag = '<TAG>', # optional + badge = None, # optional + draft = False, # optional + scheduled_at = '', # optional + content_available = False, # optional + critical = False, # optional + priority = MessagePriority.NORMAL # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..fc0a44d6cd --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,20 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_sendgrid_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + enabled = False, # optional + api_key = '<API_KEY>', # optional + from_name = '<FROM_NAME>', # optional + from_email = 'email@example.com', # optional + reply_to_name = '<REPLY_TO_NAME>', # optional + reply_to_email = '<REPLY_TO_EMAIL>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-python/examples/messaging/update-sms.md new file mode 100644 index 0000000000..2eec4e215b --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-sms.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_sms( + message_id = '<MESSAGE_ID>', + topics = [], # optional + users = [], # optional + targets = [], # optional + content = '<CONTENT>', # optional + draft = False, # optional + scheduled_at = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..80019aad40 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-smtp-provider.md @@ -0,0 +1,26 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_smtp_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + host = '<HOST>', # optional + port = 1, # optional + username = '<USERNAME>', # optional + password = '<PASSWORD>', # optional + encryption = SmtpEncryption.NONE, # optional + auto_tls = False, # optional + mailer = '<MAILER>', # optional + from_name = '<FROM_NAME>', # optional + from_email = 'email@example.com', # optional + reply_to_name = '<REPLY_TO_NAME>', # optional + reply_to_email = '<REPLY_TO_EMAIL>', # optional + enabled = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..193a26f830 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-telesign-provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_telesign_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + enabled = False, # optional + customer_id = '<CUSTOMER_ID>', # optional + api_key = '<API_KEY>', # optional + from = '<FROM>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..159f95490e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_textmagic_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + enabled = False, # optional + username = '<USERNAME>', # optional + api_key = '<API_KEY>', # optional + from = '<FROM>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-python/examples/messaging/update-topic.md new file mode 100644 index 0000000000..721f160642 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-topic.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_topic( + topic_id = '<TOPIC_ID>', + name = '<NAME>', # optional + subscribe = ["any"] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..b80c55b300 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-twilio-provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_twilio_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + enabled = False, # optional + account_sid = '<ACCOUNT_SID>', # optional + auth_token = '<AUTH_TOKEN>', # optional + from = '<FROM>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-python/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..b25f416cef --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/messaging/update-vonage-provider.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.messaging import Messaging + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging(client) + +result = messaging.update_vonage_provider( + provider_id = '<PROVIDER_ID>', + name = '<NAME>', # optional + enabled = False, # optional + api_key = '<API_KEY>', # optional + api_secret = '<API_SECRET>', # optional + from = '<FROM>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-python/examples/sites/create-deployment.md new file mode 100644 index 0000000000..de6472c4b0 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/create-deployment.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites +from appwrite.input_file import InputFile + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_deployment( + site_id = '<SITE_ID>', + code = InputFile.from_path('file.png'), + activate = False, + install_command = '<INSTALL_COMMAND>', # optional + build_command = '<BUILD_COMMAND>', # optional + output_directory = '<OUTPUT_DIRECTORY>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-python/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..d79ab9d3d1 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_duplicate_deployment( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-python/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..ac05f9e663 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/create-template-deployment.md @@ -0,0 +1,18 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_template_deployment( + site_id = '<SITE_ID>', + repository = '<REPOSITORY>', + owner = '<OWNER>', + root_directory = '<ROOT_DIRECTORY>', + version = '<VERSION>', + activate = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/create-variable.md b/docs/examples/1.7.x/server-python/examples/sites/create-variable.md new file mode 100644 index 0000000000..739beff61f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/create-variable.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_variable( + site_id = '<SITE_ID>', + key = '<KEY>', + value = '<VALUE>', + secret = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-python/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..089e6c8141 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/create-vcs-deployment.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites +from appwrite.enums import VCSDeploymentType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create_vcs_deployment( + site_id = '<SITE_ID>', + type = VCSDeploymentType.BRANCH, + reference = '<REFERENCE>', + activate = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/create.md b/docs/examples/1.7.x/server-python/examples/sites/create.md new file mode 100644 index 0000000000..4950cd2116 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/create.md @@ -0,0 +1,32 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites +from appwrite.enums import +from appwrite.enums import + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.create( + site_id = '<SITE_ID>', + name = '<NAME>', + framework = .ANALOG, + build_runtime = .NODE_14_5, + enabled = False, # optional + logging = False, # optional + timeout = 1, # optional + install_command = '<INSTALL_COMMAND>', # optional + build_command = '<BUILD_COMMAND>', # optional + output_directory = '<OUTPUT_DIRECTORY>', # optional + adapter = .STATIC, # optional + installation_id = '<INSTALLATION_ID>', # optional + fallback_file = '<FALLBACK_FILE>', # optional + provider_repository_id = '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch = '<PROVIDER_BRANCH>', # optional + provider_silent_mode = False, # optional + provider_root_directory = '<PROVIDER_ROOT_DIRECTORY>', # optional + specification = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-python/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..029730ae3f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/delete-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.delete_deployment( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/delete-log.md b/docs/examples/1.7.x/server-python/examples/sites/delete-log.md new file mode 100644 index 0000000000..0b516e6840 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/delete-log.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.delete_log( + site_id = '<SITE_ID>', + log_id = '<LOG_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-python/examples/sites/delete-variable.md new file mode 100644 index 0000000000..c078813b4a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/delete-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.delete_variable( + site_id = '<SITE_ID>', + variable_id = '<VARIABLE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/delete.md b/docs/examples/1.7.x/server-python/examples/sites/delete.md new file mode 100644 index 0000000000..60670e63e0 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.delete( + site_id = '<SITE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-python/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..d6af564217 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/get-deployment-download.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get_deployment_download( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>', + type = DeploymentDownloadType.SOURCE # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-python/examples/sites/get-deployment.md new file mode 100644 index 0000000000..c4ee1de904 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/get-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get_deployment( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/get-log.md b/docs/examples/1.7.x/server-python/examples/sites/get-log.md new file mode 100644 index 0000000000..ae5d8ac2df --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/get-log.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get_log( + site_id = '<SITE_ID>', + log_id = '<LOG_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/get-variable.md b/docs/examples/1.7.x/server-python/examples/sites/get-variable.md new file mode 100644 index 0000000000..7f5f0f6480 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/get-variable.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get_variable( + site_id = '<SITE_ID>', + variable_id = '<VARIABLE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/get.md b/docs/examples/1.7.x/server-python/examples/sites/get.md new file mode 100644 index 0000000000..f9532a0e1a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.get( + site_id = '<SITE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-python/examples/sites/list-deployments.md new file mode 100644 index 0000000000..15ec24d232 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/list-deployments.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_deployments( + site_id = '<SITE_ID>', + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-python/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..6e3764695e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/list-frameworks.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_frameworks() diff --git a/docs/examples/1.7.x/server-python/examples/sites/list-logs.md b/docs/examples/1.7.x/server-python/examples/sites/list-logs.md new file mode 100644 index 0000000000..d3a9a193c1 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/list-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_logs( + site_id = '<SITE_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-python/examples/sites/list-specifications.md new file mode 100644 index 0000000000..93b713c4b6 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/list-specifications.md @@ -0,0 +1,11 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_specifications() diff --git a/docs/examples/1.7.x/server-python/examples/sites/list-variables.md b/docs/examples/1.7.x/server-python/examples/sites/list-variables.md new file mode 100644 index 0000000000..5ff78e6a1a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/list-variables.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list_variables( + site_id = '<SITE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/list.md b/docs/examples/1.7.x/server-python/examples/sites/list.md new file mode 100644 index 0000000000..1b344e1d0f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.list( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-python/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..492ee4f747 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/update-deployment-status.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.update_deployment_status( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-python/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..69014bbbcd --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/update-site-deployment.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.update_site_deployment( + site_id = '<SITE_ID>', + deployment_id = '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/update-variable.md b/docs/examples/1.7.x/server-python/examples/sites/update-variable.md new file mode 100644 index 0000000000..973f7f2e65 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/update-variable.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.update_variable( + site_id = '<SITE_ID>', + variable_id = '<VARIABLE_ID>', + key = '<KEY>', + value = '<VALUE>', # optional + secret = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/sites/update.md b/docs/examples/1.7.x/server-python/examples/sites/update.md new file mode 100644 index 0000000000..7d2d2865a4 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/sites/update.md @@ -0,0 +1,31 @@ +from appwrite.client import Client +from appwrite.services.sites import Sites +from appwrite.enums import + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites(client) + +result = sites.update( + site_id = '<SITE_ID>', + name = '<NAME>', + framework = .ANALOG, + enabled = False, # optional + logging = False, # optional + timeout = 1, # optional + install_command = '<INSTALL_COMMAND>', # optional + build_command = '<BUILD_COMMAND>', # optional + output_directory = '<OUTPUT_DIRECTORY>', # optional + build_runtime = .NODE_14_5, # optional + adapter = .STATIC, # optional + fallback_file = '<FALLBACK_FILE>', # optional + installation_id = '<INSTALLATION_ID>', # optional + provider_repository_id = '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch = '<PROVIDER_BRANCH>', # optional + provider_silent_mode = False, # optional + provider_root_directory = '<PROVIDER_ROOT_DIRECTORY>', # optional + specification = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-python/examples/storage/create-bucket.md new file mode 100644 index 0000000000..9672782b5c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/create-bucket.md @@ -0,0 +1,22 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage(client) + +result = storage.create_bucket( + bucket_id = '<BUCKET_ID>', + name = '<NAME>', + permissions = ["read("any")"], # optional + file_security = False, # optional + enabled = False, # optional + maximum_file_size = 1, # optional + allowed_file_extensions = [], # optional + compression = .NONE, # optional + encryption = False, # optional + antivirus = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/create-file.md b/docs/examples/1.7.x/server-python/examples/storage/create-file.md new file mode 100644 index 0000000000..6e57284b85 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/create-file.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage +from appwrite.input_file import InputFile + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +storage = Storage(client) + +result = storage.create_file( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>', + file = InputFile.from_path('file.png'), + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-python/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..dd8e8ebc43 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/delete-bucket.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage(client) + +result = storage.delete_bucket( + bucket_id = '<BUCKET_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/delete-file.md b/docs/examples/1.7.x/server-python/examples/storage/delete-file.md new file mode 100644 index 0000000000..17bc251e50 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/delete-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +storage = Storage(client) + +result = storage.delete_file( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-python/examples/storage/get-bucket.md new file mode 100644 index 0000000000..e5eeb4c097 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/get-bucket.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage(client) + +result = storage.get_bucket( + bucket_id = '<BUCKET_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-python/examples/storage/get-file-download.md new file mode 100644 index 0000000000..411abf8c79 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/get-file-download.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +storage = Storage(client) + +result = storage.get_file_download( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>', + token = '<TOKEN>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-python/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..47e3f23b55 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/get-file-preview.md @@ -0,0 +1,26 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +storage = Storage(client) + +result = storage.get_file_preview( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>', + width = 0, # optional + height = 0, # optional + gravity = ImageGravity.CENTER, # optional + quality = -1, # optional + border_width = 0, # optional + border_color = '', # optional + border_radius = 0, # optional + opacity = 0, # optional + rotation = -360, # optional + background = '', # optional + output = ImageFormat.JPG, # optional + token = '<TOKEN>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-python/examples/storage/get-file-view.md new file mode 100644 index 0000000000..85cbad7902 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/get-file-view.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +storage = Storage(client) + +result = storage.get_file_view( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>', + token = '<TOKEN>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/get-file.md b/docs/examples/1.7.x/server-python/examples/storage/get-file.md new file mode 100644 index 0000000000..461543e3fd --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/get-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +storage = Storage(client) + +result = storage.get_file( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-python/examples/storage/list-buckets.md new file mode 100644 index 0000000000..51a1ae6836 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/list-buckets.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage(client) + +result = storage.list_buckets( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/list-files.md b/docs/examples/1.7.x/server-python/examples/storage/list-files.md new file mode 100644 index 0000000000..4034bd477d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/list-files.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +storage = Storage(client) + +result = storage.list_files( + bucket_id = '<BUCKET_ID>', + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-python/examples/storage/update-bucket.md new file mode 100644 index 0000000000..f2e741a5aa --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/update-bucket.md @@ -0,0 +1,22 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage(client) + +result = storage.update_bucket( + bucket_id = '<BUCKET_ID>', + name = '<NAME>', + permissions = ["read("any")"], # optional + file_security = False, # optional + enabled = False, # optional + maximum_file_size = 1, # optional + allowed_file_extensions = [], # optional + compression = .NONE, # optional + encryption = False, # optional + antivirus = False # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/storage/update-file.md b/docs/examples/1.7.x/server-python/examples/storage/update-file.md new file mode 100644 index 0000000000..cf1e5779bb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/storage/update-file.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +storage = Storage(client) + +result = storage.update_file( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>', + name = '<NAME>', # optional + permissions = ["read("any")"] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/create-membership.md b/docs/examples/1.7.x/server-python/examples/teams/create-membership.md new file mode 100644 index 0000000000..cb3bf73195 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/create-membership.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.create_membership( + team_id = '<TEAM_ID>', + roles = [], + email = 'email@example.com', # optional + user_id = '<USER_ID>', # optional + phone = '+12065550100', # optional + url = 'https://example.com', # optional + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/create.md b/docs/examples/1.7.x/server-python/examples/teams/create.md new file mode 100644 index 0000000000..f623151b27 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/create.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.create( + team_id = '<TEAM_ID>', + name = '<NAME>', + roles = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-python/examples/teams/delete-membership.md new file mode 100644 index 0000000000..6fb218266f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/delete-membership.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.delete_membership( + team_id = '<TEAM_ID>', + membership_id = '<MEMBERSHIP_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/delete.md b/docs/examples/1.7.x/server-python/examples/teams/delete.md new file mode 100644 index 0000000000..056114bfad --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.delete( + team_id = '<TEAM_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/get-membership.md b/docs/examples/1.7.x/server-python/examples/teams/get-membership.md new file mode 100644 index 0000000000..3c028a5c7e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/get-membership.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.get_membership( + team_id = '<TEAM_ID>', + membership_id = '<MEMBERSHIP_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-python/examples/teams/get-prefs.md new file mode 100644 index 0000000000..8d645897c6 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/get-prefs.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.get_prefs( + team_id = '<TEAM_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/get.md b/docs/examples/1.7.x/server-python/examples/teams/get.md new file mode 100644 index 0000000000..55f172eadd --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.get( + team_id = '<TEAM_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-python/examples/teams/list-memberships.md new file mode 100644 index 0000000000..6e6f15a284 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/list-memberships.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.list_memberships( + team_id = '<TEAM_ID>', + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/list.md b/docs/examples/1.7.x/server-python/examples/teams/list.md new file mode 100644 index 0000000000..bf91a50744 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.list( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-python/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..9c08421579 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/update-membership-status.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.update_membership_status( + team_id = '<TEAM_ID>', + membership_id = '<MEMBERSHIP_ID>', + user_id = '<USER_ID>', + secret = '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/update-membership.md b/docs/examples/1.7.x/server-python/examples/teams/update-membership.md new file mode 100644 index 0000000000..db20c5aaae --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/update-membership.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.update_membership( + team_id = '<TEAM_ID>', + membership_id = '<MEMBERSHIP_ID>', + roles = [] +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/update-name.md b/docs/examples/1.7.x/server-python/examples/teams/update-name.md new file mode 100644 index 0000000000..160b496932 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/update-name.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.update_name( + team_id = '<TEAM_ID>', + name = '<NAME>' +) diff --git a/docs/examples/1.7.x/server-python/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-python/examples/teams/update-prefs.md new file mode 100644 index 0000000000..e82da1b64f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/teams/update-prefs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_session('') # The user session to authenticate with + +teams = Teams(client) + +result = teams.update_prefs( + team_id = '<TEAM_ID>', + prefs = {} +) diff --git a/docs/examples/1.7.x/server-python/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-python/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..f835a0ea8d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/tokens/create-file-token.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.create_file_token( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>', + expire = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/tokens/delete.md b/docs/examples/1.7.x/server-python/examples/tokens/delete.md new file mode 100644 index 0000000000..47619321ff --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/tokens/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.delete( + token_id = '<TOKEN_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/tokens/get.md b/docs/examples/1.7.x/server-python/examples/tokens/get.md new file mode 100644 index 0000000000..0d6abb81d7 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/tokens/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.get( + token_id = '<TOKEN_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/tokens/list.md b/docs/examples/1.7.x/server-python/examples/tokens/list.md new file mode 100644 index 0000000000..2694650ed3 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/tokens/list.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.list( + bucket_id = '<BUCKET_ID>', + file_id = '<FILE_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/tokens/update.md b/docs/examples/1.7.x/server-python/examples/tokens/update.md new file mode 100644 index 0000000000..18b04445cc --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/tokens/update.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.tokens import Tokens + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens(client) + +result = tokens.update( + token_id = '<TOKEN_ID>', + expire = '' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-python/examples/users/create-argon2user.md new file mode 100644 index 0000000000..5e95cc26ac --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-argon2user.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_argon2_user( + user_id = '<USER_ID>', + email = 'email@example.com', + password = 'password', + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-python/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..d3d9e21586 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-bcrypt-user.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_bcrypt_user( + user_id = '<USER_ID>', + email = 'email@example.com', + password = 'password', + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-python/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..bed6c483e0 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-j-w-t.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_jwt( + user_id = '<USER_ID>', + session_id = '<SESSION_ID>', # optional + duration = 0 # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-python/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..b1cbb53f23 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-m-d5user.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_md5_user( + user_id = '<USER_ID>', + email = 'email@example.com', + password = 'password', + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-python/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..64a87c05ff --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_mfa_recovery_codes( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-python/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..33f65f44d9 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-p-h-pass-user.md @@ -0,0 +1,16 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_ph_pass_user( + user_id = '<USER_ID>', + email = 'email@example.com', + password = 'password', + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-python/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..5b4c8f831a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-s-h-a-user.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_sha_user( + user_id = '<USER_ID>', + email = 'email@example.com', + password = 'password', + password_version = PasswordHash.SHA1, # optional + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-python/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..9d644ce4ca --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_scrypt_modified_user( + user_id = '<USER_ID>', + email = 'email@example.com', + password = 'password', + password_salt = '<PASSWORD_SALT>', + password_salt_separator = '<PASSWORD_SALT_SEPARATOR>', + password_signer_key = '<PASSWORD_SIGNER_KEY>', + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-python/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..f442ab9d3e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-scrypt-user.md @@ -0,0 +1,21 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_scrypt_user( + user_id = '<USER_ID>', + email = 'email@example.com', + password = 'password', + password_salt = '<PASSWORD_SALT>', + password_cpu = None, + password_memory = None, + password_parallel = None, + password_length = None, + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-session.md b/docs/examples/1.7.x/server-python/examples/users/create-session.md new file mode 100644 index 0000000000..7e4c49fc95 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-session.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_session( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-target.md b/docs/examples/1.7.x/server-python/examples/users/create-target.md new file mode 100644 index 0000000000..dfa64ac757 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-target.md @@ -0,0 +1,19 @@ +from appwrite.client import Client +from appwrite.services.users import Users +from appwrite.enums import MessagingProviderType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_target( + user_id = '<USER_ID>', + target_id = '<TARGET_ID>', + provider_type = MessagingProviderType.EMAIL, + identifier = '<IDENTIFIER>', + provider_id = '<PROVIDER_ID>', # optional + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create-token.md b/docs/examples/1.7.x/server-python/examples/users/create-token.md new file mode 100644 index 0000000000..b40658c312 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create-token.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create_token( + user_id = '<USER_ID>', + length = 4, # optional + expire = 60 # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/create.md b/docs/examples/1.7.x/server-python/examples/users/create.md new file mode 100644 index 0000000000..4c51a3fffb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/create.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.create( + user_id = '<USER_ID>', + email = 'email@example.com', # optional + phone = '+12065550100', # optional + password = '', # optional + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/delete-identity.md b/docs/examples/1.7.x/server-python/examples/users/delete-identity.md new file mode 100644 index 0000000000..412fbd393a --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/delete-identity.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.delete_identity( + identity_id = '<IDENTITY_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-python/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..6472498344 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.users import Users +from appwrite.enums import AuthenticatorType + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.delete_mfa_authenticator( + user_id = '<USER_ID>', + type = AuthenticatorType.TOTP +) diff --git a/docs/examples/1.7.x/server-python/examples/users/delete-session.md b/docs/examples/1.7.x/server-python/examples/users/delete-session.md new file mode 100644 index 0000000000..815a96ed37 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/delete-session.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.delete_session( + user_id = '<USER_ID>', + session_id = '<SESSION_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-python/examples/users/delete-sessions.md new file mode 100644 index 0000000000..2dde88f471 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/delete-sessions.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.delete_sessions( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/delete-target.md b/docs/examples/1.7.x/server-python/examples/users/delete-target.md new file mode 100644 index 0000000000..287f5a26cf --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/delete-target.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.delete_target( + user_id = '<USER_ID>', + target_id = '<TARGET_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/delete.md b/docs/examples/1.7.x/server-python/examples/users/delete.md new file mode 100644 index 0000000000..7032b0f81e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/delete.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.delete( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-python/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..bca43b08ec --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.get_mfa_recovery_codes( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/get-prefs.md b/docs/examples/1.7.x/server-python/examples/users/get-prefs.md new file mode 100644 index 0000000000..ec9d363f8d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/get-prefs.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.get_prefs( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/get-target.md b/docs/examples/1.7.x/server-python/examples/users/get-target.md new file mode 100644 index 0000000000..3b80b1ff7f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/get-target.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.get_target( + user_id = '<USER_ID>', + target_id = '<TARGET_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/get.md b/docs/examples/1.7.x/server-python/examples/users/get.md new file mode 100644 index 0000000000..267086a3df --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/get.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.get( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/list-identities.md b/docs/examples/1.7.x/server-python/examples/users/list-identities.md new file mode 100644 index 0000000000..0fc7811a3f --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/list-identities.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.list_identities( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/list-logs.md b/docs/examples/1.7.x/server-python/examples/users/list-logs.md new file mode 100644 index 0000000000..6cbbe498cb --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/list-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.list_logs( + user_id = '<USER_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/list-memberships.md b/docs/examples/1.7.x/server-python/examples/users/list-memberships.md new file mode 100644 index 0000000000..c0d2f2a468 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/list-memberships.md @@ -0,0 +1,15 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.list_memberships( + user_id = '<USER_ID>', + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-python/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..a2b59895e8 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/list-mfa-factors.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.list_mfa_factors( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/list-sessions.md b/docs/examples/1.7.x/server-python/examples/users/list-sessions.md new file mode 100644 index 0000000000..77b04c935e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/list-sessions.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.list_sessions( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/list-targets.md b/docs/examples/1.7.x/server-python/examples/users/list-targets.md new file mode 100644 index 0000000000..14107fa296 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/list-targets.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.list_targets( + user_id = '<USER_ID>', + queries = [] # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/list.md b/docs/examples/1.7.x/server-python/examples/users/list.md new file mode 100644 index 0000000000..778f33935d --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.list( + queries = [], # optional + search = '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-python/examples/users/update-email-verification.md new file mode 100644 index 0000000000..2605861416 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-email-verification.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_email_verification( + user_id = '<USER_ID>', + email_verification = False +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-email.md b/docs/examples/1.7.x/server-python/examples/users/update-email.md new file mode 100644 index 0000000000..c4a468e234 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-email.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_email( + user_id = '<USER_ID>', + email = 'email@example.com' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-labels.md b/docs/examples/1.7.x/server-python/examples/users/update-labels.md new file mode 100644 index 0000000000..b9af53a50e --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-labels.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_labels( + user_id = '<USER_ID>', + labels = [] +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-python/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..c0990e1ef7 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_mfa_recovery_codes( + user_id = '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-mfa.md b/docs/examples/1.7.x/server-python/examples/users/update-mfa.md new file mode 100644 index 0000000000..9b35701185 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-mfa.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_mfa( + user_id = '<USER_ID>', + mfa = False +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-name.md b/docs/examples/1.7.x/server-python/examples/users/update-name.md new file mode 100644 index 0000000000..1e328b4c48 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-name.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_name( + user_id = '<USER_ID>', + name = '<NAME>' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-password.md b/docs/examples/1.7.x/server-python/examples/users/update-password.md new file mode 100644 index 0000000000..d104184cad --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-password.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_password( + user_id = '<USER_ID>', + password = '' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-python/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..1d2656c3f1 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-phone-verification.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_phone_verification( + user_id = '<USER_ID>', + phone_verification = False +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-phone.md b/docs/examples/1.7.x/server-python/examples/users/update-phone.md new file mode 100644 index 0000000000..14826bb54c --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-phone.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_phone( + user_id = '<USER_ID>', + number = '+12065550100' +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-prefs.md b/docs/examples/1.7.x/server-python/examples/users/update-prefs.md new file mode 100644 index 0000000000..76903b7611 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-prefs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_prefs( + user_id = '<USER_ID>', + prefs = {} +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-status.md b/docs/examples/1.7.x/server-python/examples/users/update-status.md new file mode 100644 index 0000000000..49c0516ee4 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-status.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_status( + user_id = '<USER_ID>', + status = False +) diff --git a/docs/examples/1.7.x/server-python/examples/users/update-target.md b/docs/examples/1.7.x/server-python/examples/users/update-target.md new file mode 100644 index 0000000000..119c5fab88 --- /dev/null +++ b/docs/examples/1.7.x/server-python/examples/users/update-target.md @@ -0,0 +1,17 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() +client.set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint +client.set_project('<YOUR_PROJECT_ID>') # Your project ID +client.set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users(client) + +result = users.update_target( + user_id = '<USER_ID>', + target_id = '<TARGET_ID>', + identifier = '<IDENTIFIER>', # optional + provider_id = '<PROVIDER_ID>', # optional + name = '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-rest/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..2079b045d1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-anonymous-session.md @@ -0,0 +1,6 @@ +POST /v1/account/sessions/anonymous HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-rest/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..8aee0e5b15 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-email-password-session.md @@ -0,0 +1,10 @@ +POST /v1/account/sessions/email HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + +{ + "email": "email@example.com", + "password": "password" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-email-token.md b/docs/examples/1.7.x/server-rest/examples/account/create-email-token.md new file mode 100644 index 0000000000..98c5c9b454 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-email-token.md @@ -0,0 +1,11 @@ +POST /v1/account/tokens/email HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "phrase": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-rest/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..a8da4695c3 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-j-w-t.md @@ -0,0 +1,6 @@ +POST /v1/account/jwts HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-rest/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..a3db43516a --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,12 @@ +POST /v1/account/tokens/magic-url HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "url": "https://example.com", + "phrase": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-rest/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..8d6b52b877 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-mfa-authenticator.md @@ -0,0 +1,8 @@ +POST /v1/account/mfa/authenticators/{type} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-rest/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..9a84c0ef69 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-mfa-challenge.md @@ -0,0 +1,9 @@ +POST /v1/account/mfa/challenge HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + +{ + "factor": "email" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-rest/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..797824d5d7 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,8 @@ +POST /v1/account/mfa/recovery-codes HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-rest/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..dd1dd3ec5e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-o-auth2token.md @@ -0,0 +1,4 @@ +GET /v1/account/tokens/oauth2/{provider} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-rest/examples/account/create-phone-token.md new file mode 100644 index 0000000000..eef1021d9e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-phone-token.md @@ -0,0 +1,10 @@ +POST /v1/account/tokens/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + +{ + "userId": "<USER_ID>", + "phone": "+12065550100" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-rest/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..d161e580ff --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-phone-verification.md @@ -0,0 +1,8 @@ +POST /v1/account/verification/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-recovery.md b/docs/examples/1.7.x/server-rest/examples/account/create-recovery.md new file mode 100644 index 0000000000..c195b96a5e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-recovery.md @@ -0,0 +1,12 @@ +POST /v1/account/recovery HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "email": "email@example.com", + "url": "https://example.com" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-session.md b/docs/examples/1.7.x/server-rest/examples/account/create-session.md new file mode 100644 index 0000000000..18e3b1acdd --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-session.md @@ -0,0 +1,10 @@ +POST /v1/account/sessions/token HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + +{ + "userId": "<USER_ID>", + "secret": "<SECRET>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/create-verification.md b/docs/examples/1.7.x/server-rest/examples/account/create-verification.md new file mode 100644 index 0000000000..1185d3a875 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create-verification.md @@ -0,0 +1,11 @@ +POST /v1/account/verification HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "url": "https://example.com" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/create.md b/docs/examples/1.7.x/server-rest/examples/account/create.md new file mode 100644 index 0000000000..f546c07de5 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/create.md @@ -0,0 +1,12 @@ +POST /v1/account HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "password": , + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/delete-identity.md b/docs/examples/1.7.x/server-rest/examples/account/delete-identity.md new file mode 100644 index 0000000000..edb036a593 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/delete-identity.md @@ -0,0 +1,8 @@ +DELETE /v1/account/identities/{identityId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-rest/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..de58948195 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,8 @@ +DELETE /v1/account/mfa/authenticators/{type} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/delete-session.md b/docs/examples/1.7.x/server-rest/examples/account/delete-session.md new file mode 100644 index 0000000000..9454a84913 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/delete-session.md @@ -0,0 +1,8 @@ +DELETE /v1/account/sessions/{sessionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-rest/examples/account/delete-sessions.md new file mode 100644 index 0000000000..97931c12e5 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/delete-sessions.md @@ -0,0 +1,8 @@ +DELETE /v1/account/sessions HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-rest/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..81edee5234 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,6 @@ +GET /v1/account/mfa/recovery-codes HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/account/get-prefs.md b/docs/examples/1.7.x/server-rest/examples/account/get-prefs.md new file mode 100644 index 0000000000..13a0b74d8f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/get-prefs.md @@ -0,0 +1,6 @@ +GET /v1/account/prefs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/account/get-session.md b/docs/examples/1.7.x/server-rest/examples/account/get-session.md new file mode 100644 index 0000000000..9417755b04 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/get-session.md @@ -0,0 +1,6 @@ +GET /v1/account/sessions/{sessionId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/account/get.md b/docs/examples/1.7.x/server-rest/examples/account/get.md new file mode 100644 index 0000000000..023a6d116f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/get.md @@ -0,0 +1,6 @@ +GET /v1/account HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/account/list-identities.md b/docs/examples/1.7.x/server-rest/examples/account/list-identities.md new file mode 100644 index 0000000000..65edceb8d6 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/list-identities.md @@ -0,0 +1,6 @@ +GET /v1/account/identities HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/account/list-logs.md b/docs/examples/1.7.x/server-rest/examples/account/list-logs.md new file mode 100644 index 0000000000..71e2e138ef --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/list-logs.md @@ -0,0 +1,6 @@ +GET /v1/account/logs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-rest/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..217ec6cb30 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/list-mfa-factors.md @@ -0,0 +1,6 @@ +GET /v1/account/mfa/factors HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/account/list-sessions.md b/docs/examples/1.7.x/server-rest/examples/account/list-sessions.md new file mode 100644 index 0000000000..7bff23f25b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/list-sessions.md @@ -0,0 +1,6 @@ +GET /v1/account/sessions HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-email.md b/docs/examples/1.7.x/server-rest/examples/account/update-email.md new file mode 100644 index 0000000000..fc3baaf4a4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-email.md @@ -0,0 +1,12 @@ +PATCH /v1/account/email HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "email": "email@example.com", + "password": "password" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-rest/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..803c47a857 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-m-f-a.md @@ -0,0 +1,11 @@ +PATCH /v1/account/mfa HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "mfa": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-rest/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..3238322e0f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,10 @@ +PUT /v1/account/sessions/magic-url HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + +{ + "userId": "<USER_ID>", + "secret": "<SECRET>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-rest/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..9d3e5dceea --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-mfa-authenticator.md @@ -0,0 +1,11 @@ +PUT /v1/account/mfa/authenticators/{type} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "otp": "<OTP>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-rest/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..ddc27ae334 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-mfa-challenge.md @@ -0,0 +1,12 @@ +PUT /v1/account/mfa/challenge HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "challengeId": "<CHALLENGE_ID>", + "otp": "<OTP>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-rest/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..e4ab8abb3b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,8 @@ +PATCH /v1/account/mfa/recovery-codes HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-name.md b/docs/examples/1.7.x/server-rest/examples/account/update-name.md new file mode 100644 index 0000000000..f2f7caa204 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-name.md @@ -0,0 +1,11 @@ +PATCH /v1/account/name HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-password.md b/docs/examples/1.7.x/server-rest/examples/account/update-password.md new file mode 100644 index 0000000000..4f69b9ab3f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-password.md @@ -0,0 +1,12 @@ +PATCH /v1/account/password HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "password": , + "oldPassword": "password" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-rest/examples/account/update-phone-session.md new file mode 100644 index 0000000000..f1bc27d201 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-phone-session.md @@ -0,0 +1,10 @@ +PUT /v1/account/sessions/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> + +{ + "userId": "<USER_ID>", + "secret": "<SECRET>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-rest/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..ee6f5a68ff --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-phone-verification.md @@ -0,0 +1,12 @@ +PUT /v1/account/verification/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "userId": "<USER_ID>", + "secret": "<SECRET>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-phone.md b/docs/examples/1.7.x/server-rest/examples/account/update-phone.md new file mode 100644 index 0000000000..bbe602a181 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-phone.md @@ -0,0 +1,12 @@ +PATCH /v1/account/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "phone": "+12065550100", + "password": "password" +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-prefs.md b/docs/examples/1.7.x/server-rest/examples/account/update-prefs.md new file mode 100644 index 0000000000..aeabc2b68f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-prefs.md @@ -0,0 +1,11 @@ +PATCH /v1/account/prefs HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "prefs": {} +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-recovery.md b/docs/examples/1.7.x/server-rest/examples/account/update-recovery.md new file mode 100644 index 0000000000..054aacc8ed --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-recovery.md @@ -0,0 +1,13 @@ +PUT /v1/account/recovery HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "userId": "<USER_ID>", + "secret": "<SECRET>", + "password": +} diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-session.md b/docs/examples/1.7.x/server-rest/examples/account/update-session.md new file mode 100644 index 0000000000..9b2ba0e4a7 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-session.md @@ -0,0 +1,8 @@ +PATCH /v1/account/sessions/{sessionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-status.md b/docs/examples/1.7.x/server-rest/examples/account/update-status.md new file mode 100644 index 0000000000..8a3e01db0b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-status.md @@ -0,0 +1,8 @@ +PATCH /v1/account/status HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/account/update-verification.md b/docs/examples/1.7.x/server-rest/examples/account/update-verification.md new file mode 100644 index 0000000000..0c5ed8b55d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/account/update-verification.md @@ -0,0 +1,12 @@ +PUT /v1/account/verification HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "userId": "<USER_ID>", + "secret": "<SECRET>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-rest/examples/avatars/get-browser.md new file mode 100644 index 0000000000..3f18fa0d1e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/avatars/get-browser.md @@ -0,0 +1,7 @@ +GET /v1/avatars/browsers/{code} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-rest/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..59a38fe8f3 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/avatars/get-credit-card.md @@ -0,0 +1,7 @@ +GET /v1/avatars/credit-cards/{code} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-rest/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..7a7c189da1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/avatars/get-favicon.md @@ -0,0 +1,7 @@ +GET /v1/avatars/favicon HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-rest/examples/avatars/get-flag.md new file mode 100644 index 0000000000..b4cd119359 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/avatars/get-flag.md @@ -0,0 +1,7 @@ +GET /v1/avatars/flags/{code} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/avatars/get-image.md b/docs/examples/1.7.x/server-rest/examples/avatars/get-image.md new file mode 100644 index 0000000000..ca6b5105c3 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/avatars/get-image.md @@ -0,0 +1,7 @@ +GET /v1/avatars/image HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-rest/examples/avatars/get-initials.md new file mode 100644 index 0000000000..eb90447158 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/avatars/get-initials.md @@ -0,0 +1,7 @@ +GET /v1/avatars/initials HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-rest/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..77f7a3d382 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/avatars/get-q-r.md @@ -0,0 +1,7 @@ +GET /v1/avatars/qr HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..8ae6c2d9ff --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-boolean-attribute.md @@ -0,0 +1,13 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/boolean HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "required": false, + "default": false, + "array": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-collection.md b/docs/examples/1.7.x/server-rest/examples/databases/create-collection.md new file mode 100644 index 0000000000..ea298e3706 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-collection.md @@ -0,0 +1,14 @@ +POST /v1/databases/{databaseId}/collections HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "collectionId": "<COLLECTION_ID>", + "name": "<NAME>", + "permissions": ["read(\"any\")"], + "documentSecurity": false, + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..6ec4b332a5 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-datetime-attribute.md @@ -0,0 +1,13 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/datetime HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "required": false, + "default": , + "array": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-document.md b/docs/examples/1.7.x/server-rest/examples/databases/create-document.md new file mode 100644 index 0000000000..a5c25315c2 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-document.md @@ -0,0 +1,14 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + +{ + "documentId": "<DOCUMENT_ID>", + "data": {}, + "permissions": ["read(\"any\")"] +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-documents.md b/docs/examples/1.7.x/server-rest/examples/databases/create-documents.md new file mode 100644 index 0000000000..63503ebaaa --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-documents.md @@ -0,0 +1,12 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + +{ + "documents": [] +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..0fb7aa2814 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-email-attribute.md @@ -0,0 +1,13 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/email HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "required": false, + "default": "email@example.com", + "array": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..ba033a02ce --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-enum-attribute.md @@ -0,0 +1,14 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/enum HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "elements": [], + "required": false, + "default": "<DEFAULT>", + "array": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..ee8cb7497f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-float-attribute.md @@ -0,0 +1,15 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/float HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "required": false, + "min": 0, + "max": 0, + "default": 0, + "array": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-index.md b/docs/examples/1.7.x/server-rest/examples/databases/create-index.md new file mode 100644 index 0000000000..6d9b486ed6 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-index.md @@ -0,0 +1,14 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/indexes HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "type": "key", + "attributes": [], + "orders": [], + "lengths": [] +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..721f10e0c7 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-integer-attribute.md @@ -0,0 +1,15 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/integer HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "required": false, + "min": 0, + "max": 0, + "default": 0, + "array": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..61378e6780 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-ip-attribute.md @@ -0,0 +1,13 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/ip HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "required": false, + "default": , + "array": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..c519a4a494 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-relationship-attribute.md @@ -0,0 +1,15 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/relationship HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "relatedCollectionId": "<RELATED_COLLECTION_ID>", + "type": "oneToOne", + "twoWay": false, + "key": , + "twoWayKey": , + "onDelete": "cascade" +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..7a5eafdf2a --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-string-attribute.md @@ -0,0 +1,15 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/string HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "size": 1, + "required": false, + "default": "<DEFAULT>", + "array": false, + "encrypt": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..ea4d76ce06 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create-url-attribute.md @@ -0,0 +1,13 @@ +POST /v1/databases/{databaseId}/collections/{collectionId}/attributes/url HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": , + "required": false, + "default": "https://example.com", + "array": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/create.md b/docs/examples/1.7.x/server-rest/examples/databases/create.md new file mode 100644 index 0000000000..dab52ff67c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/create.md @@ -0,0 +1,12 @@ +POST /v1/databases HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "databaseId": "<DATABASE_ID>", + "name": "<NAME>", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..8b7f1eee07 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/delete-attribute.md @@ -0,0 +1,7 @@ +DELETE /v1/databases/{databaseId}/collections/{collectionId}/attributes/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-rest/examples/databases/delete-collection.md new file mode 100644 index 0000000000..153b3a2bdd --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/delete-collection.md @@ -0,0 +1,7 @@ +DELETE /v1/databases/{databaseId}/collections/{collectionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/databases/delete-document.md b/docs/examples/1.7.x/server-rest/examples/databases/delete-document.md new file mode 100644 index 0000000000..ca093c9177 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/delete-document.md @@ -0,0 +1,9 @@ +DELETE /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-rest/examples/databases/delete-documents.md new file mode 100644 index 0000000000..49ab276fa6 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/delete-documents.md @@ -0,0 +1,10 @@ +DELETE /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "queries": [] +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/delete-index.md b/docs/examples/1.7.x/server-rest/examples/databases/delete-index.md new file mode 100644 index 0000000000..9c27a6fd4c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/delete-index.md @@ -0,0 +1,7 @@ +DELETE /v1/databases/{databaseId}/collections/{collectionId}/indexes/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/databases/delete.md b/docs/examples/1.7.x/server-rest/examples/databases/delete.md new file mode 100644 index 0000000000..19cf58549a --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/delete.md @@ -0,0 +1,7 @@ +DELETE /v1/databases/{databaseId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/get-attribute.md new file mode 100644 index 0000000000..c4cd093de0 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/get-attribute.md @@ -0,0 +1,5 @@ +GET /v1/databases/{databaseId}/collections/{collectionId}/attributes/{key} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/get-collection.md b/docs/examples/1.7.x/server-rest/examples/databases/get-collection.md new file mode 100644 index 0000000000..0e33fc4ef7 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/get-collection.md @@ -0,0 +1,5 @@ +GET /v1/databases/{databaseId}/collections/{collectionId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/get-document.md b/docs/examples/1.7.x/server-rest/examples/databases/get-document.md new file mode 100644 index 0000000000..b71ec4f83c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/get-document.md @@ -0,0 +1,7 @@ +GET /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/get-index.md b/docs/examples/1.7.x/server-rest/examples/databases/get-index.md new file mode 100644 index 0000000000..5aa5aa0fb2 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/get-index.md @@ -0,0 +1,5 @@ +GET /v1/databases/{databaseId}/collections/{collectionId}/indexes/{key} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/get.md b/docs/examples/1.7.x/server-rest/examples/databases/get.md new file mode 100644 index 0000000000..7c43330625 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/get.md @@ -0,0 +1,5 @@ +GET /v1/databases/{databaseId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-rest/examples/databases/list-attributes.md new file mode 100644 index 0000000000..e829678007 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/list-attributes.md @@ -0,0 +1,5 @@ +GET /v1/databases/{databaseId}/collections/{collectionId}/attributes HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/list-collections.md b/docs/examples/1.7.x/server-rest/examples/databases/list-collections.md new file mode 100644 index 0000000000..0cfdce9c8e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/list-collections.md @@ -0,0 +1,5 @@ +GET /v1/databases/{databaseId}/collections HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/list-documents.md b/docs/examples/1.7.x/server-rest/examples/databases/list-documents.md new file mode 100644 index 0000000000..0bc5c9b7f9 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/list-documents.md @@ -0,0 +1,7 @@ +GET /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-rest/examples/databases/list-indexes.md new file mode 100644 index 0000000000..e65ba2483c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/list-indexes.md @@ -0,0 +1,5 @@ +GET /v1/databases/{databaseId}/collections/{collectionId}/indexes HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/list.md b/docs/examples/1.7.x/server-rest/examples/databases/list.md new file mode 100644 index 0000000000..31db5cca0d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/list.md @@ -0,0 +1,5 @@ +GET /v1/databases HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..7a2ae34ce9 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-boolean-attribute.md @@ -0,0 +1,12 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/boolean/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "required": false, + "default": false, + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-collection.md b/docs/examples/1.7.x/server-rest/examples/databases/update-collection.md new file mode 100644 index 0000000000..4cba7f5230 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-collection.md @@ -0,0 +1,13 @@ +PUT /v1/databases/{databaseId}/collections/{collectionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "permissions": ["read(\"any\")"], + "documentSecurity": false, + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..c9685e6c89 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-datetime-attribute.md @@ -0,0 +1,12 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/datetime/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "required": false, + "default": , + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-document.md b/docs/examples/1.7.x/server-rest/examples/databases/update-document.md new file mode 100644 index 0000000000..19b25bdf45 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-document.md @@ -0,0 +1,13 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/documents/{documentId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + +{ + "data": {}, + "permissions": ["read(\"any\")"] +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-documents.md b/docs/examples/1.7.x/server-rest/examples/databases/update-documents.md new file mode 100644 index 0000000000..f2606e3a1f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-documents.md @@ -0,0 +1,11 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "data": {}, + "queries": [] +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..eece253459 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-email-attribute.md @@ -0,0 +1,12 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/email/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "required": false, + "default": "email@example.com", + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..47ef168090 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-enum-attribute.md @@ -0,0 +1,13 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/enum/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "elements": [], + "required": false, + "default": "<DEFAULT>", + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..bb35f3450c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-float-attribute.md @@ -0,0 +1,14 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/float/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "required": false, + "min": 0, + "max": 0, + "default": 0, + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..96290f4313 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-integer-attribute.md @@ -0,0 +1,14 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/integer/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "required": false, + "min": 0, + "max": 0, + "default": 0, + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..9e3cf7d4b5 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-ip-attribute.md @@ -0,0 +1,12 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/ip/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "required": false, + "default": , + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..645e8f8ae4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-relationship-attribute.md @@ -0,0 +1,11 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/{key}/relationship HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "onDelete": "cascade", + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..650b6f1b8b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-string-attribute.md @@ -0,0 +1,13 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/string/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "required": false, + "default": "<DEFAULT>", + "size": 1, + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-rest/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..8409285677 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update-url-attribute.md @@ -0,0 +1,12 @@ +PATCH /v1/databases/{databaseId}/collections/{collectionId}/attributes/url/{key} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "required": false, + "default": "https://example.com", + "newKey": +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/update.md b/docs/examples/1.7.x/server-rest/examples/databases/update.md new file mode 100644 index 0000000000..02efbf5270 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/update.md @@ -0,0 +1,11 @@ +PUT /v1/databases/{databaseId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-rest/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..fbe82d4a4e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/databases/upsert-documents.md @@ -0,0 +1,10 @@ +PUT /v1/databases/{databaseId}/collections/{collectionId}/documents HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "documents": [] +} diff --git a/docs/examples/1.7.x/server-rest/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-rest/examples/functions/create-deployment.md new file mode 100644 index 0000000000..5d65eff5fd --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/create-deployment.md @@ -0,0 +1,30 @@ +POST /v1/functions/{functionId}/deployments HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> +Content-Length: *Length of your entity body in bytes* + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="entrypoint" + +"<ENTRYPOINT>" + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="commands" + +"<COMMANDS>" + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="code" + +cf 94 84 24 8d c4 91 10 0f dc 54 26 6c 8e 4b bc +e8 ee 55 94 29 e7 94 89 19 26 28 01 26 29 3f 16... + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="activate" + +false + +--cec8e8123c05ba25-- diff --git a/docs/examples/1.7.x/server-rest/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-rest/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..898117c117 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,11 @@ +POST /v1/functions/{functionId}/deployments/duplicate HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "deploymentId": "<DEPLOYMENT_ID>", + "buildId": "<BUILD_ID>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/functions/create-execution.md b/docs/examples/1.7.x/server-rest/examples/functions/create-execution.md new file mode 100644 index 0000000000..5a4c7667cf --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/create-execution.md @@ -0,0 +1,17 @@ +POST /v1/functions/{functionId}/executions HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + +{ + "body": "<BODY>", + "async": false, + "path": "<PATH>", + "method": "GET", + "headers": {}, + "scheduledAt": +} diff --git a/docs/examples/1.7.x/server-rest/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-rest/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..656c2e2a27 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/create-template-deployment.md @@ -0,0 +1,14 @@ +POST /v1/functions/{functionId}/deployments/template HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "repository": "<REPOSITORY>", + "owner": "<OWNER>", + "rootDirectory": "<ROOT_DIRECTORY>", + "version": "<VERSION>", + "activate": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/functions/create-variable.md b/docs/examples/1.7.x/server-rest/examples/functions/create-variable.md new file mode 100644 index 0000000000..7251a3a352 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/create-variable.md @@ -0,0 +1,12 @@ +POST /v1/functions/{functionId}/variables HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": "<KEY>", + "value": "<VALUE>", + "secret": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-rest/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..1b5267ca14 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/create-vcs-deployment.md @@ -0,0 +1,12 @@ +POST /v1/functions/{functionId}/deployments/vcs HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "type": "branch", + "reference": "<REFERENCE>", + "activate": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/functions/create.md b/docs/examples/1.7.x/server-rest/examples/functions/create.md new file mode 100644 index 0000000000..c5f364ad63 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/create.md @@ -0,0 +1,27 @@ +POST /v1/functions HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "functionId": "<FUNCTION_ID>", + "name": "<NAME>", + "runtime": "node-14.5", + "execute": ["any"], + "events": [], + "schedule": , + "timeout": 1, + "enabled": false, + "logging": false, + "entrypoint": "<ENTRYPOINT>", + "commands": "<COMMANDS>", + "scopes": [], + "installationId": "<INSTALLATION_ID>", + "providerRepositoryId": "<PROVIDER_REPOSITORY_ID>", + "providerBranch": "<PROVIDER_BRANCH>", + "providerSilentMode": false, + "providerRootDirectory": "<PROVIDER_ROOT_DIRECTORY>", + "specification": +} diff --git a/docs/examples/1.7.x/server-rest/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-rest/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..b70f282167 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/delete-deployment.md @@ -0,0 +1,7 @@ +DELETE /v1/functions/{functionId}/deployments/{deploymentId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-rest/examples/functions/delete-execution.md new file mode 100644 index 0000000000..fb26ae47aa --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/delete-execution.md @@ -0,0 +1,7 @@ +DELETE /v1/functions/{functionId}/executions/{executionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-rest/examples/functions/delete-variable.md new file mode 100644 index 0000000000..aa01835ae4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/delete-variable.md @@ -0,0 +1,7 @@ +DELETE /v1/functions/{functionId}/variables/{variableId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/functions/delete.md b/docs/examples/1.7.x/server-rest/examples/functions/delete.md new file mode 100644 index 0000000000..9f9ab74019 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/delete.md @@ -0,0 +1,7 @@ +DELETE /v1/functions/{functionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-rest/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..9195d203ab --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/get-deployment-download.md @@ -0,0 +1,6 @@ +GET /v1/functions/{functionId}/deployments/{deploymentId}/download HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-rest/examples/functions/get-deployment.md new file mode 100644 index 0000000000..2557ca698e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/get-deployment.md @@ -0,0 +1,5 @@ +GET /v1/functions/{functionId}/deployments/{deploymentId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/get-execution.md b/docs/examples/1.7.x/server-rest/examples/functions/get-execution.md new file mode 100644 index 0000000000..52e54c2a6c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/get-execution.md @@ -0,0 +1,7 @@ +GET /v1/functions/{functionId}/executions/{executionId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/get-variable.md b/docs/examples/1.7.x/server-rest/examples/functions/get-variable.md new file mode 100644 index 0000000000..2a01307b0d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/get-variable.md @@ -0,0 +1,5 @@ +GET /v1/functions/{functionId}/variables/{variableId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/get.md b/docs/examples/1.7.x/server-rest/examples/functions/get.md new file mode 100644 index 0000000000..062b7e67ec --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/get.md @@ -0,0 +1,5 @@ +GET /v1/functions/{functionId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-rest/examples/functions/list-deployments.md new file mode 100644 index 0000000000..5b4dabc679 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/list-deployments.md @@ -0,0 +1,5 @@ +GET /v1/functions/{functionId}/deployments HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/list-executions.md b/docs/examples/1.7.x/server-rest/examples/functions/list-executions.md new file mode 100644 index 0000000000..b0ac3076ab --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/list-executions.md @@ -0,0 +1,7 @@ +GET /v1/functions/{functionId}/executions HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-rest/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..762e47fbcb --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/list-runtimes.md @@ -0,0 +1,5 @@ +GET /v1/functions/runtimes HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-rest/examples/functions/list-specifications.md new file mode 100644 index 0000000000..989adc0576 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/list-specifications.md @@ -0,0 +1,5 @@ +GET /v1/functions/specifications HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/list-variables.md b/docs/examples/1.7.x/server-rest/examples/functions/list-variables.md new file mode 100644 index 0000000000..b46b69fb5f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/list-variables.md @@ -0,0 +1,5 @@ +GET /v1/functions/{functionId}/variables HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/list.md b/docs/examples/1.7.x/server-rest/examples/functions/list.md new file mode 100644 index 0000000000..318a2d56ed --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/list.md @@ -0,0 +1,5 @@ +GET /v1/functions HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-rest/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..8788e21c2b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/update-deployment-status.md @@ -0,0 +1,7 @@ +PATCH /v1/functions/{functionId}/deployments/{deploymentId}/status HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-rest/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..1f89f35da0 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/update-function-deployment.md @@ -0,0 +1,10 @@ +PATCH /v1/functions/{functionId}/deployment HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "deploymentId": "<DEPLOYMENT_ID>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/functions/update-variable.md b/docs/examples/1.7.x/server-rest/examples/functions/update-variable.md new file mode 100644 index 0000000000..36ae244548 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/update-variable.md @@ -0,0 +1,12 @@ +PUT /v1/functions/{functionId}/variables/{variableId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": "<KEY>", + "value": "<VALUE>", + "secret": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/functions/update.md b/docs/examples/1.7.x/server-rest/examples/functions/update.md new file mode 100644 index 0000000000..ee3b8b8c6d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/functions/update.md @@ -0,0 +1,26 @@ +PUT /v1/functions/{functionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "runtime": "node-14.5", + "execute": ["any"], + "events": [], + "schedule": , + "timeout": 1, + "enabled": false, + "logging": false, + "entrypoint": "<ENTRYPOINT>", + "commands": "<COMMANDS>", + "scopes": [], + "installationId": "<INSTALLATION_ID>", + "providerRepositoryId": "<PROVIDER_REPOSITORY_ID>", + "providerBranch": "<PROVIDER_BRANCH>", + "providerSilentMode": false, + "providerRootDirectory": "<PROVIDER_ROOT_DIRECTORY>", + "specification": +} diff --git a/docs/examples/1.7.x/server-rest/examples/graphql/mutation.md b/docs/examples/1.7.x/server-rest/examples/graphql/mutation.md new file mode 100644 index 0000000000..7d58d77ede --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/graphql/mutation.md @@ -0,0 +1,13 @@ +POST /v1/graphql/mutation HTTP/1.1 +Host: cloud.appwrite.io +X-Sdk-Graphql: true +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "query": {} +} diff --git a/docs/examples/1.7.x/server-rest/examples/graphql/query.md b/docs/examples/1.7.x/server-rest/examples/graphql/query.md new file mode 100644 index 0000000000..8b87cd9f33 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/graphql/query.md @@ -0,0 +1,13 @@ +POST /v1/graphql HTTP/1.1 +Host: cloud.appwrite.io +X-Sdk-Graphql: true +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "query": {} +} diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-rest/examples/health/get-antivirus.md new file mode 100644 index 0000000000..2acacb5a5f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-antivirus.md @@ -0,0 +1,5 @@ +GET /v1/health/anti-virus HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-cache.md b/docs/examples/1.7.x/server-rest/examples/health/get-cache.md new file mode 100644 index 0000000000..c98dcf8af1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-cache.md @@ -0,0 +1,5 @@ +GET /v1/health/cache HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-certificate.md b/docs/examples/1.7.x/server-rest/examples/health/get-certificate.md new file mode 100644 index 0000000000..9f4f5efee4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-certificate.md @@ -0,0 +1,5 @@ +GET /v1/health/certificate HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-d-b.md b/docs/examples/1.7.x/server-rest/examples/health/get-d-b.md new file mode 100644 index 0000000000..9f1efb921b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-d-b.md @@ -0,0 +1,5 @@ +GET /v1/health/db HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-rest/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..b646b7923f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-failed-jobs.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/failed/{name} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-rest/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..d28025f719 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-pub-sub.md @@ -0,0 +1,5 @@ +GET /v1/health/pubsub HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..d51b4d60b3 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-builds.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/builds HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..0f3c2f65fe --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-certificates.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/certificates HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..ccc72c3404 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-databases.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/databases HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..a4c5e15586 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-deletes.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/deletes HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..a28dbf921c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-functions.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/functions HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..0c16e61757 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-logs.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/logs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..82b6151af1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-mails.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/mails HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..6082ec41bd --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-messaging.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/messaging HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..c9687b3224 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-migrations.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/migrations HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..90eefe75fc --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-stats-resources.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/stats-resources HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..663d39dd2f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-usage.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/stats-usage HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-rest/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..0843ad174f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-queue-webhooks.md @@ -0,0 +1,5 @@ +GET /v1/health/queue/webhooks HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-rest/examples/health/get-storage-local.md new file mode 100644 index 0000000000..9047713439 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-storage-local.md @@ -0,0 +1,5 @@ +GET /v1/health/storage/local HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-storage.md b/docs/examples/1.7.x/server-rest/examples/health/get-storage.md new file mode 100644 index 0000000000..1d46ab179e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-storage.md @@ -0,0 +1,5 @@ +GET /v1/health/storage HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get-time.md b/docs/examples/1.7.x/server-rest/examples/health/get-time.md new file mode 100644 index 0000000000..7661df5732 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get-time.md @@ -0,0 +1,5 @@ +GET /v1/health/time HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/health/get.md b/docs/examples/1.7.x/server-rest/examples/health/get.md new file mode 100644 index 0000000000..c64b480826 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/health/get.md @@ -0,0 +1,5 @@ +GET /v1/health HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/locale/get.md b/docs/examples/1.7.x/server-rest/examples/locale/get.md new file mode 100644 index 0000000000..7b300acb41 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/locale/get.md @@ -0,0 +1,7 @@ +GET /v1/locale HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/locale/list-codes.md b/docs/examples/1.7.x/server-rest/examples/locale/list-codes.md new file mode 100644 index 0000000000..336ac1477f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/locale/list-codes.md @@ -0,0 +1,7 @@ +GET /v1/locale/codes HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/locale/list-continents.md b/docs/examples/1.7.x/server-rest/examples/locale/list-continents.md new file mode 100644 index 0000000000..d99b138653 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/locale/list-continents.md @@ -0,0 +1,7 @@ +GET /v1/locale/continents HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-rest/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..3c94877234 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/locale/list-countries-e-u.md @@ -0,0 +1,7 @@ +GET /v1/locale/countries/eu HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-rest/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..09619edb36 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/locale/list-countries-phones.md @@ -0,0 +1,7 @@ +GET /v1/locale/countries/phones HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/locale/list-countries.md b/docs/examples/1.7.x/server-rest/examples/locale/list-countries.md new file mode 100644 index 0000000000..0f1be7e5df --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/locale/list-countries.md @@ -0,0 +1,7 @@ +GET /v1/locale/countries HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-rest/examples/locale/list-currencies.md new file mode 100644 index 0000000000..c1e03ecae2 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/locale/list-currencies.md @@ -0,0 +1,7 @@ +GET /v1/locale/currencies HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/locale/list-languages.md b/docs/examples/1.7.x/server-rest/examples/locale/list-languages.md new file mode 100644 index 0000000000..1e2a125985 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/locale/list-languages.md @@ -0,0 +1,7 @@ +GET /v1/locale/languages HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..b6860358c1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-apns-provider.md @@ -0,0 +1,17 @@ +POST /v1/messaging/providers/apns HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "authKey": "<AUTH_KEY>", + "authKeyId": "<AUTH_KEY_ID>", + "teamId": "<TEAM_ID>", + "bundleId": "<BUNDLE_ID>", + "sandbox": false, + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-email.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-email.md new file mode 100644 index 0000000000..efec44982c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-email.md @@ -0,0 +1,21 @@ +POST /v1/messaging/messages/email HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "messageId": "<MESSAGE_ID>", + "subject": "<SUBJECT>", + "content": "<CONTENT>", + "topics": [], + "users": [], + "targets": [], + "cc": [], + "bcc": [], + "attachments": [], + "draft": false, + "html": false, + "scheduledAt": +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..ec885465a7 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-fcm-provider.md @@ -0,0 +1,13 @@ +POST /v1/messaging/providers/fcm HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "serviceAccountJSON": {}, + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..8d0eb33938 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,19 @@ +POST /v1/messaging/providers/mailgun HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "apiKey": "<API_KEY>", + "domain": "<DOMAIN>", + "isEuRegion": false, + "fromName": "<FROM_NAME>", + "fromEmail": "email@example.com", + "replyToName": "<REPLY_TO_NAME>", + "replyToEmail": "email@example.com", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..2877ff7b89 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-msg91provider.md @@ -0,0 +1,15 @@ +POST /v1/messaging/providers/msg91 HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "templateId": "<TEMPLATE_ID>", + "senderId": "<SENDER_ID>", + "authKey": "<AUTH_KEY>", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-push.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-push.md new file mode 100644 index 0000000000..6210273820 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-push.md @@ -0,0 +1,28 @@ +POST /v1/messaging/messages/push HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "messageId": "<MESSAGE_ID>", + "title": "<TITLE>", + "body": "<BODY>", + "topics": [], + "users": [], + "targets": [], + "data": {}, + "action": "<ACTION>", + "image": "[ID1:ID2]", + "icon": "<ICON>", + "sound": "<SOUND>", + "color": "<COLOR>", + "tag": "<TAG>", + "badge": 0, + "draft": false, + "scheduledAt": , + "contentAvailable": false, + "critical": false, + "priority": "normal" +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..a9f7c933dc --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,17 @@ +POST /v1/messaging/providers/sendgrid HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "apiKey": "<API_KEY>", + "fromName": "<FROM_NAME>", + "fromEmail": "email@example.com", + "replyToName": "<REPLY_TO_NAME>", + "replyToEmail": "email@example.com", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-sms.md new file mode 100644 index 0000000000..f885563f6f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-sms.md @@ -0,0 +1,16 @@ +POST /v1/messaging/messages/sms HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "messageId": "<MESSAGE_ID>", + "content": "<CONTENT>", + "topics": [], + "users": [], + "targets": [], + "draft": false, + "scheduledAt": +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..bbb8e7d212 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-smtp-provider.md @@ -0,0 +1,23 @@ +POST /v1/messaging/providers/smtp HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "host": "<HOST>", + "port": 1, + "username": "<USERNAME>", + "password": "<PASSWORD>", + "encryption": "none", + "autoTLS": false, + "mailer": "<MAILER>", + "fromName": "<FROM_NAME>", + "fromEmail": "email@example.com", + "replyToName": "<REPLY_TO_NAME>", + "replyToEmail": "email@example.com", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..2e61d50b5c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-subscriber.md @@ -0,0 +1,13 @@ +POST /v1/messaging/topics/{topicId}/subscribers HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-JWT: <YOUR_JWT> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "subscriberId": "<SUBSCRIBER_ID>", + "targetId": "<TARGET_ID>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..198ccae6f5 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-telesign-provider.md @@ -0,0 +1,15 @@ +POST /v1/messaging/providers/telesign HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "from": "+12065550100", + "customerId": "<CUSTOMER_ID>", + "apiKey": "<API_KEY>", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..2f2ce558a7 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,15 @@ +POST /v1/messaging/providers/textmagic HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "from": "+12065550100", + "username": "<USERNAME>", + "apiKey": "<API_KEY>", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-topic.md new file mode 100644 index 0000000000..a44af2764d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-topic.md @@ -0,0 +1,12 @@ +POST /v1/messaging/topics HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "topicId": "<TOPIC_ID>", + "name": "<NAME>", + "subscribe": ["any"] +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..61fd63b52e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-twilio-provider.md @@ -0,0 +1,15 @@ +POST /v1/messaging/providers/twilio HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "from": "+12065550100", + "accountSid": "<ACCOUNT_SID>", + "authToken": "<AUTH_TOKEN>", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..16d1c6b594 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/create-vonage-provider.md @@ -0,0 +1,15 @@ +POST /v1/messaging/providers/vonage HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "providerId": "<PROVIDER_ID>", + "name": "<NAME>", + "from": "+12065550100", + "apiKey": "<API_KEY>", + "apiSecret": "<API_SECRET>", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..e25c3dcc1c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/delete-provider.md @@ -0,0 +1,7 @@ +DELETE /v1/messaging/providers/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-rest/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..b988897d60 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/delete-subscriber.md @@ -0,0 +1,9 @@ +DELETE /v1/messaging/topics/{topicId}/subscribers/{subscriberId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-JWT: <YOUR_JWT> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-rest/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..3c5c8a9cdb --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/delete-topic.md @@ -0,0 +1,7 @@ +DELETE /v1/messaging/topics/{topicId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/delete.md b/docs/examples/1.7.x/server-rest/examples/messaging/delete.md new file mode 100644 index 0000000000..a918c2b6f8 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/delete.md @@ -0,0 +1,7 @@ +DELETE /v1/messaging/messages/{messageId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/get-message.md b/docs/examples/1.7.x/server-rest/examples/messaging/get-message.md new file mode 100644 index 0000000000..abe744e9c7 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/get-message.md @@ -0,0 +1,5 @@ +GET /v1/messaging/messages/{messageId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/get-provider.md new file mode 100644 index 0000000000..0d2ffe4eaa --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/get-provider.md @@ -0,0 +1,5 @@ +GET /v1/messaging/providers/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-rest/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..a1629d4546 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/get-subscriber.md @@ -0,0 +1,5 @@ +GET /v1/messaging/topics/{topicId}/subscribers/{subscriberId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-rest/examples/messaging/get-topic.md new file mode 100644 index 0000000000..5d7efd06de --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/get-topic.md @@ -0,0 +1,5 @@ +GET /v1/messaging/topics/{topicId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-rest/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..066970a9fb --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/list-message-logs.md @@ -0,0 +1,5 @@ +GET /v1/messaging/messages/{messageId}/logs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-rest/examples/messaging/list-messages.md new file mode 100644 index 0000000000..03a286c376 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/list-messages.md @@ -0,0 +1,5 @@ +GET /v1/messaging/messages HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-rest/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..562264f48e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/list-provider-logs.md @@ -0,0 +1,5 @@ +GET /v1/messaging/providers/{providerId}/logs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-rest/examples/messaging/list-providers.md new file mode 100644 index 0000000000..43522ee34f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/list-providers.md @@ -0,0 +1,5 @@ +GET /v1/messaging/providers HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-rest/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..f403362529 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,5 @@ +GET /v1/messaging/subscribers/{subscriberId}/logs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-rest/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..a357f9dc3d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/list-subscribers.md @@ -0,0 +1,5 @@ +GET /v1/messaging/topics/{topicId}/subscribers HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-rest/examples/messaging/list-targets.md new file mode 100644 index 0000000000..0b4f8caf6f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/list-targets.md @@ -0,0 +1,5 @@ +GET /v1/messaging/messages/{messageId}/targets HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-rest/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..80073b2165 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/list-topic-logs.md @@ -0,0 +1,5 @@ +GET /v1/messaging/topics/{topicId}/logs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-rest/examples/messaging/list-topics.md new file mode 100644 index 0000000000..2835277aeb --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/list-topics.md @@ -0,0 +1,5 @@ +GET /v1/messaging/topics HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..a398b186cb --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-apns-provider.md @@ -0,0 +1,16 @@ +PATCH /v1/messaging/providers/apns/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "enabled": false, + "authKey": "<AUTH_KEY>", + "authKeyId": "<AUTH_KEY_ID>", + "teamId": "<TEAM_ID>", + "bundleId": "<BUNDLE_ID>", + "sandbox": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-email.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-email.md new file mode 100644 index 0000000000..0ef5b89409 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-email.md @@ -0,0 +1,20 @@ +PATCH /v1/messaging/messages/email/{messageId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "topics": [], + "users": [], + "targets": [], + "subject": "<SUBJECT>", + "content": "<CONTENT>", + "draft": false, + "html": false, + "cc": [], + "bcc": [], + "scheduledAt": , + "attachments": [] +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..50e3a5400d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-fcm-provider.md @@ -0,0 +1,12 @@ +PATCH /v1/messaging/providers/fcm/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "enabled": false, + "serviceAccountJSON": {} +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..f05f0057e7 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,18 @@ +PATCH /v1/messaging/providers/mailgun/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "apiKey": "<API_KEY>", + "domain": "<DOMAIN>", + "isEuRegion": false, + "enabled": false, + "fromName": "<FROM_NAME>", + "fromEmail": "email@example.com", + "replyToName": "<REPLY_TO_NAME>", + "replyToEmail": "<REPLY_TO_EMAIL>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..1c88425fc1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-msg91provider.md @@ -0,0 +1,14 @@ +PATCH /v1/messaging/providers/msg91/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "enabled": false, + "templateId": "<TEMPLATE_ID>", + "senderId": "<SENDER_ID>", + "authKey": "<AUTH_KEY>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-push.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-push.md new file mode 100644 index 0000000000..adf269301c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-push.md @@ -0,0 +1,27 @@ +PATCH /v1/messaging/messages/push/{messageId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "topics": [], + "users": [], + "targets": [], + "title": "<TITLE>", + "body": "<BODY>", + "data": {}, + "action": "<ACTION>", + "image": "[ID1:ID2]", + "icon": "<ICON>", + "sound": "<SOUND>", + "color": "<COLOR>", + "tag": "<TAG>", + "badge": 0, + "draft": false, + "scheduledAt": , + "contentAvailable": false, + "critical": false, + "priority": "normal" +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..28ffb526f8 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,16 @@ +PATCH /v1/messaging/providers/sendgrid/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "enabled": false, + "apiKey": "<API_KEY>", + "fromName": "<FROM_NAME>", + "fromEmail": "email@example.com", + "replyToName": "<REPLY_TO_NAME>", + "replyToEmail": "<REPLY_TO_EMAIL>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-sms.md new file mode 100644 index 0000000000..b5ad82d0f9 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-sms.md @@ -0,0 +1,15 @@ +PATCH /v1/messaging/messages/sms/{messageId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "topics": [], + "users": [], + "targets": [], + "content": "<CONTENT>", + "draft": false, + "scheduledAt": +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..8e69659ce1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-smtp-provider.md @@ -0,0 +1,22 @@ +PATCH /v1/messaging/providers/smtp/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "host": "<HOST>", + "port": 1, + "username": "<USERNAME>", + "password": "<PASSWORD>", + "encryption": "none", + "autoTLS": false, + "mailer": "<MAILER>", + "fromName": "<FROM_NAME>", + "fromEmail": "email@example.com", + "replyToName": "<REPLY_TO_NAME>", + "replyToEmail": "<REPLY_TO_EMAIL>", + "enabled": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..548d39dc92 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-telesign-provider.md @@ -0,0 +1,14 @@ +PATCH /v1/messaging/providers/telesign/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "enabled": false, + "customerId": "<CUSTOMER_ID>", + "apiKey": "<API_KEY>", + "from": "<FROM>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..724b0a4afe --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,14 @@ +PATCH /v1/messaging/providers/textmagic/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "enabled": false, + "username": "<USERNAME>", + "apiKey": "<API_KEY>", + "from": "<FROM>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-topic.md new file mode 100644 index 0000000000..add0bf8ee4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-topic.md @@ -0,0 +1,11 @@ +PATCH /v1/messaging/topics/{topicId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "subscribe": ["any"] +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..38730383b1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-twilio-provider.md @@ -0,0 +1,14 @@ +PATCH /v1/messaging/providers/twilio/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "enabled": false, + "accountSid": "<ACCOUNT_SID>", + "authToken": "<AUTH_TOKEN>", + "from": "<FROM>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-rest/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..8c284c827f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/messaging/update-vonage-provider.md @@ -0,0 +1,14 @@ +PATCH /v1/messaging/providers/vonage/{providerId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "enabled": false, + "apiKey": "<API_KEY>", + "apiSecret": "<API_SECRET>", + "from": "<FROM>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-rest/examples/sites/create-deployment.md new file mode 100644 index 0000000000..554d2a5365 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/create-deployment.md @@ -0,0 +1,35 @@ +POST /v1/sites/{siteId}/deployments HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> +Content-Length: *Length of your entity body in bytes* + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="installCommand" + +"<INSTALL_COMMAND>" + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="buildCommand" + +"<BUILD_COMMAND>" + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="outputDirectory" + +"<OUTPUT_DIRECTORY>" + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="code" + +cf 94 84 24 8d c4 91 10 0f dc 54 26 6c 8e 4b bc +e8 ee 55 94 29 e7 94 89 19 26 28 01 26 29 3f 16... + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="activate" + +false + +--cec8e8123c05ba25-- diff --git a/docs/examples/1.7.x/server-rest/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-rest/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..3da246715b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,10 @@ +POST /v1/sites/{siteId}/deployments/duplicate HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "deploymentId": "<DEPLOYMENT_ID>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-rest/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..e37819bfb2 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/create-template-deployment.md @@ -0,0 +1,14 @@ +POST /v1/sites/{siteId}/deployments/template HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "repository": "<REPOSITORY>", + "owner": "<OWNER>", + "rootDirectory": "<ROOT_DIRECTORY>", + "version": "<VERSION>", + "activate": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/sites/create-variable.md b/docs/examples/1.7.x/server-rest/examples/sites/create-variable.md new file mode 100644 index 0000000000..73217d198c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/create-variable.md @@ -0,0 +1,12 @@ +POST /v1/sites/{siteId}/variables HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": "<KEY>", + "value": "<VALUE>", + "secret": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-rest/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..7d5fd3e92e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/create-vcs-deployment.md @@ -0,0 +1,12 @@ +POST /v1/sites/{siteId}/deployments/vcs HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "type": "branch", + "reference": "<REFERENCE>", + "activate": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/sites/create.md b/docs/examples/1.7.x/server-rest/examples/sites/create.md new file mode 100644 index 0000000000..5493e9d2b6 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/create.md @@ -0,0 +1,27 @@ +POST /v1/sites HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "siteId": "<SITE_ID>", + "name": "<NAME>", + "framework": "analog", + "enabled": false, + "logging": false, + "timeout": 1, + "installCommand": "<INSTALL_COMMAND>", + "buildCommand": "<BUILD_COMMAND>", + "outputDirectory": "<OUTPUT_DIRECTORY>", + "buildRuntime": "node-14.5", + "adapter": "static", + "installationId": "<INSTALLATION_ID>", + "fallbackFile": "<FALLBACK_FILE>", + "providerRepositoryId": "<PROVIDER_REPOSITORY_ID>", + "providerBranch": "<PROVIDER_BRANCH>", + "providerSilentMode": false, + "providerRootDirectory": "<PROVIDER_ROOT_DIRECTORY>", + "specification": +} diff --git a/docs/examples/1.7.x/server-rest/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-rest/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..35bac59efc --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/delete-deployment.md @@ -0,0 +1,7 @@ +DELETE /v1/sites/{siteId}/deployments/{deploymentId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/sites/delete-log.md b/docs/examples/1.7.x/server-rest/examples/sites/delete-log.md new file mode 100644 index 0000000000..0bd2f661cf --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/delete-log.md @@ -0,0 +1,7 @@ +DELETE /v1/sites/{siteId}/logs/{logId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-rest/examples/sites/delete-variable.md new file mode 100644 index 0000000000..c3f1d2d293 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/delete-variable.md @@ -0,0 +1,7 @@ +DELETE /v1/sites/{siteId}/variables/{variableId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/sites/delete.md b/docs/examples/1.7.x/server-rest/examples/sites/delete.md new file mode 100644 index 0000000000..cdb4ced577 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/delete.md @@ -0,0 +1,7 @@ +DELETE /v1/sites/{siteId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-rest/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..d81a7dfc56 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/get-deployment-download.md @@ -0,0 +1,6 @@ +GET /v1/sites/{siteId}/deployments/{deploymentId}/download HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-rest/examples/sites/get-deployment.md new file mode 100644 index 0000000000..381c20db77 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/get-deployment.md @@ -0,0 +1,5 @@ +GET /v1/sites/{siteId}/deployments/{deploymentId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/get-log.md b/docs/examples/1.7.x/server-rest/examples/sites/get-log.md new file mode 100644 index 0000000000..6b8366461e --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/get-log.md @@ -0,0 +1,5 @@ +GET /v1/sites/{siteId}/logs/{logId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/get-variable.md b/docs/examples/1.7.x/server-rest/examples/sites/get-variable.md new file mode 100644 index 0000000000..7c9703ef88 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/get-variable.md @@ -0,0 +1,5 @@ +GET /v1/sites/{siteId}/variables/{variableId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/get.md b/docs/examples/1.7.x/server-rest/examples/sites/get.md new file mode 100644 index 0000000000..f13b46ecab --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/get.md @@ -0,0 +1,5 @@ +GET /v1/sites/{siteId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-rest/examples/sites/list-deployments.md new file mode 100644 index 0000000000..22512f809d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/list-deployments.md @@ -0,0 +1,5 @@ +GET /v1/sites/{siteId}/deployments HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-rest/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..0007a7cd78 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/list-frameworks.md @@ -0,0 +1,5 @@ +GET /v1/sites/frameworks HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/list-logs.md b/docs/examples/1.7.x/server-rest/examples/sites/list-logs.md new file mode 100644 index 0000000000..7e77b7e755 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/list-logs.md @@ -0,0 +1,5 @@ +GET /v1/sites/{siteId}/logs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-rest/examples/sites/list-specifications.md new file mode 100644 index 0000000000..17e8d281c6 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/list-specifications.md @@ -0,0 +1,5 @@ +GET /v1/sites/specifications HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/list-variables.md b/docs/examples/1.7.x/server-rest/examples/sites/list-variables.md new file mode 100644 index 0000000000..4f99a74984 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/list-variables.md @@ -0,0 +1,5 @@ +GET /v1/sites/{siteId}/variables HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/list.md b/docs/examples/1.7.x/server-rest/examples/sites/list.md new file mode 100644 index 0000000000..d1800f05e5 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/list.md @@ -0,0 +1,5 @@ +GET /v1/sites HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-rest/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..697d9ac371 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/update-deployment-status.md @@ -0,0 +1,7 @@ +PATCH /v1/sites/{siteId}/deployments/{deploymentId}/status HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-rest/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..51d8736df5 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/update-site-deployment.md @@ -0,0 +1,10 @@ +PATCH /v1/sites/{siteId}/deployment HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "deploymentId": "<DEPLOYMENT_ID>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/sites/update-variable.md b/docs/examples/1.7.x/server-rest/examples/sites/update-variable.md new file mode 100644 index 0000000000..61902ee02f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/update-variable.md @@ -0,0 +1,12 @@ +PUT /v1/sites/{siteId}/variables/{variableId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "key": "<KEY>", + "value": "<VALUE>", + "secret": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/sites/update.md b/docs/examples/1.7.x/server-rest/examples/sites/update.md new file mode 100644 index 0000000000..ab3c4dddd1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/sites/update.md @@ -0,0 +1,26 @@ +PUT /v1/sites/{siteId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "framework": "analog", + "enabled": false, + "logging": false, + "timeout": 1, + "installCommand": "<INSTALL_COMMAND>", + "buildCommand": "<BUILD_COMMAND>", + "outputDirectory": "<OUTPUT_DIRECTORY>", + "buildRuntime": "node-14.5", + "adapter": "static", + "fallbackFile": "<FALLBACK_FILE>", + "installationId": "<INSTALLATION_ID>", + "providerRepositoryId": "<PROVIDER_REPOSITORY_ID>", + "providerBranch": "<PROVIDER_BRANCH>", + "providerSilentMode": false, + "providerRootDirectory": "<PROVIDER_ROOT_DIRECTORY>", + "specification": +} diff --git a/docs/examples/1.7.x/server-rest/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-rest/examples/storage/create-bucket.md new file mode 100644 index 0000000000..8ca9c5701b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/create-bucket.md @@ -0,0 +1,19 @@ +POST /v1/storage/buckets HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "bucketId": "<BUCKET_ID>", + "name": "<NAME>", + "permissions": ["read(\"any\")"], + "fileSecurity": false, + "enabled": false, + "maximumFileSize": 1, + "allowedFileExtensions": [], + "compression": "none", + "encryption": false, + "antivirus": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/storage/create-file.md b/docs/examples/1.7.x/server-rest/examples/storage/create-file.md new file mode 100644 index 0000000000..e8a54e723b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/create-file.md @@ -0,0 +1,27 @@ +POST /v1/storage/buckets/{bucketId}/files HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> +Content-Length: *Length of your entity body in bytes* + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="fileId" + +"<FILE_ID>" + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="file" + +cf 94 84 24 8d c4 91 10 0f dc 54 26 6c 8e 4b bc +e8 ee 55 94 29 e7 94 89 19 26 28 01 26 29 3f 16... + +--cec8e8123c05ba25 +Content-Disposition: form-data; name="permissions[]" + +["read(\"any\")"] + +--cec8e8123c05ba25-- diff --git a/docs/examples/1.7.x/server-rest/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-rest/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..3db8bfbb72 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/delete-bucket.md @@ -0,0 +1,7 @@ +DELETE /v1/storage/buckets/{bucketId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/storage/delete-file.md b/docs/examples/1.7.x/server-rest/examples/storage/delete-file.md new file mode 100644 index 0000000000..cc8a2481f7 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/delete-file.md @@ -0,0 +1,9 @@ +DELETE /v1/storage/buckets/{bucketId}/files/{fileId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-rest/examples/storage/get-bucket.md new file mode 100644 index 0000000000..b7def1d44b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/get-bucket.md @@ -0,0 +1,5 @@ +GET /v1/storage/buckets/{bucketId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-rest/examples/storage/get-file-download.md new file mode 100644 index 0000000000..4d9c691ba9 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/get-file-download.md @@ -0,0 +1,7 @@ +GET /v1/storage/buckets/{bucketId}/files/{fileId}/download HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-rest/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..e8a1bdeedf --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/get-file-preview.md @@ -0,0 +1,7 @@ +GET /v1/storage/buckets/{bucketId}/files/{fileId}/preview HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-rest/examples/storage/get-file-view.md new file mode 100644 index 0000000000..d41b8a3512 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/get-file-view.md @@ -0,0 +1,7 @@ +GET /v1/storage/buckets/{bucketId}/files/{fileId}/view HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/storage/get-file.md b/docs/examples/1.7.x/server-rest/examples/storage/get-file.md new file mode 100644 index 0000000000..e11aaa9f05 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/get-file.md @@ -0,0 +1,7 @@ +GET /v1/storage/buckets/{bucketId}/files/{fileId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-rest/examples/storage/list-buckets.md new file mode 100644 index 0000000000..3061208d75 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/list-buckets.md @@ -0,0 +1,5 @@ +GET /v1/storage/buckets HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/storage/list-files.md b/docs/examples/1.7.x/server-rest/examples/storage/list-files.md new file mode 100644 index 0000000000..7cf8616335 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/list-files.md @@ -0,0 +1,7 @@ +GET /v1/storage/buckets/{bucketId}/files HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-rest/examples/storage/update-bucket.md new file mode 100644 index 0000000000..adf12647e2 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/update-bucket.md @@ -0,0 +1,18 @@ +PUT /v1/storage/buckets/{bucketId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>", + "permissions": ["read(\"any\")"], + "fileSecurity": false, + "enabled": false, + "maximumFileSize": 1, + "allowedFileExtensions": [], + "compression": "none", + "encryption": false, + "antivirus": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/storage/update-file.md b/docs/examples/1.7.x/server-rest/examples/storage/update-file.md new file mode 100644 index 0000000000..d91ab4c2d6 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/storage/update-file.md @@ -0,0 +1,13 @@ +PUT /v1/storage/buckets/{bucketId}/files/{fileId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + +{ + "name": "<NAME>", + "permissions": ["read(\"any\")"] +} diff --git a/docs/examples/1.7.x/server-rest/examples/teams/create-membership.md b/docs/examples/1.7.x/server-rest/examples/teams/create-membership.md new file mode 100644 index 0000000000..f52f796d90 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/create-membership.md @@ -0,0 +1,17 @@ +POST /v1/teams/{teamId}/memberships HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + +{ + "email": "email@example.com", + "userId": "<USER_ID>", + "phone": "+12065550100", + "roles": [], + "url": "https://example.com", + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/teams/create.md b/docs/examples/1.7.x/server-rest/examples/teams/create.md new file mode 100644 index 0000000000..27e7429464 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/create.md @@ -0,0 +1,14 @@ +POST /v1/teams HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + +{ + "teamId": "<TEAM_ID>", + "name": "<NAME>", + "roles": [] +} diff --git a/docs/examples/1.7.x/server-rest/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-rest/examples/teams/delete-membership.md new file mode 100644 index 0000000000..e897d84a12 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/delete-membership.md @@ -0,0 +1,9 @@ +DELETE /v1/teams/{teamId}/memberships/{membershipId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/teams/delete.md b/docs/examples/1.7.x/server-rest/examples/teams/delete.md new file mode 100644 index 0000000000..213489c7fb --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/delete.md @@ -0,0 +1,9 @@ +DELETE /v1/teams/{teamId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + diff --git a/docs/examples/1.7.x/server-rest/examples/teams/get-membership.md b/docs/examples/1.7.x/server-rest/examples/teams/get-membership.md new file mode 100644 index 0000000000..1d10cfe437 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/get-membership.md @@ -0,0 +1,7 @@ +GET /v1/teams/{teamId}/memberships/{membershipId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-rest/examples/teams/get-prefs.md new file mode 100644 index 0000000000..ddb863181d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/get-prefs.md @@ -0,0 +1,6 @@ +GET /v1/teams/{teamId}/prefs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/teams/get.md b/docs/examples/1.7.x/server-rest/examples/teams/get.md new file mode 100644 index 0000000000..4ecf74596b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/get.md @@ -0,0 +1,7 @@ +GET /v1/teams/{teamId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-rest/examples/teams/list-memberships.md new file mode 100644 index 0000000000..38cc17b71a --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/list-memberships.md @@ -0,0 +1,7 @@ +GET /v1/teams/{teamId}/memberships HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/teams/list.md b/docs/examples/1.7.x/server-rest/examples/teams/list.md new file mode 100644 index 0000000000..c67b429008 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/list.md @@ -0,0 +1,7 @@ +GET /v1/teams HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> diff --git a/docs/examples/1.7.x/server-rest/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-rest/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..9d828118f0 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/update-membership-status.md @@ -0,0 +1,12 @@ +PATCH /v1/teams/{teamId}/memberships/{membershipId}/status HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "userId": "<USER_ID>", + "secret": "<SECRET>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/teams/update-membership.md b/docs/examples/1.7.x/server-rest/examples/teams/update-membership.md new file mode 100644 index 0000000000..6730d5c27c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/update-membership.md @@ -0,0 +1,12 @@ +PATCH /v1/teams/{teamId}/memberships/{membershipId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + +{ + "roles": [] +} diff --git a/docs/examples/1.7.x/server-rest/examples/teams/update-name.md b/docs/examples/1.7.x/server-rest/examples/teams/update-name.md new file mode 100644 index 0000000000..fa811a2438 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/update-name.md @@ -0,0 +1,12 @@ +PUT /v1/teams/{teamId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-Key: <YOUR_API_KEY> +X-Appwrite-JWT: <YOUR_JWT> + +{ + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-rest/examples/teams/update-prefs.md new file mode 100644 index 0000000000..1db6300350 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/teams/update-prefs.md @@ -0,0 +1,11 @@ +PUT /v1/teams/{teamId}/prefs HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Session: +X-Appwrite-JWT: <YOUR_JWT> + +{ + "prefs": {} +} diff --git a/docs/examples/1.7.x/server-rest/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-rest/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..c1fbb63d2d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/tokens/create-file-token.md @@ -0,0 +1,10 @@ +POST /v1/tokens/buckets/{bucketId}/files/{fileId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "expire": +} diff --git a/docs/examples/1.7.x/server-rest/examples/tokens/delete.md b/docs/examples/1.7.x/server-rest/examples/tokens/delete.md new file mode 100644 index 0000000000..ee564b01c4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/tokens/delete.md @@ -0,0 +1,7 @@ +DELETE /v1/tokens/{tokenId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/tokens/get.md b/docs/examples/1.7.x/server-rest/examples/tokens/get.md new file mode 100644 index 0000000000..b39c8390e3 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/tokens/get.md @@ -0,0 +1,5 @@ +GET /v1/tokens/{tokenId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/tokens/list.md b/docs/examples/1.7.x/server-rest/examples/tokens/list.md new file mode 100644 index 0000000000..8909d05572 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/tokens/list.md @@ -0,0 +1,5 @@ +GET /v1/tokens/buckets/{bucketId}/files/{fileId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/tokens/update.md b/docs/examples/1.7.x/server-rest/examples/tokens/update.md new file mode 100644 index 0000000000..8ab9d60555 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/tokens/update.md @@ -0,0 +1,10 @@ +PATCH /v1/tokens/{tokenId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "expire": +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-rest/examples/users/create-argon2user.md new file mode 100644 index 0000000000..d557cf6d5f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-argon2user.md @@ -0,0 +1,13 @@ +POST /v1/users/argon2 HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "password": "password", + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-rest/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..cda7491160 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-bcrypt-user.md @@ -0,0 +1,13 @@ +POST /v1/users/bcrypt HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "password": "password", + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-rest/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..83208adadb --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-j-w-t.md @@ -0,0 +1,11 @@ +POST /v1/users/{userId}/jwts HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "sessionId": "<SESSION_ID>", + "duration": 0 +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-rest/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..d4896133a1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-m-d5user.md @@ -0,0 +1,13 @@ +POST /v1/users/md5 HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "password": "password", + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-rest/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..2f6524646d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,7 @@ +PATCH /v1/users/{userId}/mfa/recovery-codes HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-rest/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..4c10b1a82d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-p-h-pass-user.md @@ -0,0 +1,13 @@ +POST /v1/users/phpass HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "password": "password", + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-rest/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..5c6467a2fe --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-s-h-a-user.md @@ -0,0 +1,14 @@ +POST /v1/users/sha HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "password": "password", + "passwordVersion": "sha1", + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-rest/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..19d0650840 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,16 @@ +POST /v1/users/scrypt-modified HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "password": "password", + "passwordSalt": "<PASSWORD_SALT>", + "passwordSaltSeparator": "<PASSWORD_SALT_SEPARATOR>", + "passwordSignerKey": "<PASSWORD_SIGNER_KEY>", + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-rest/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..008eab6848 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-scrypt-user.md @@ -0,0 +1,18 @@ +POST /v1/users/scrypt HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "password": "password", + "passwordSalt": "<PASSWORD_SALT>", + "passwordCpu": 0, + "passwordMemory": 0, + "passwordParallel": 0, + "passwordLength": 0, + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-session.md b/docs/examples/1.7.x/server-rest/examples/users/create-session.md new file mode 100644 index 0000000000..ec71d421e0 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-session.md @@ -0,0 +1,7 @@ +POST /v1/users/{userId}/sessions HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-target.md b/docs/examples/1.7.x/server-rest/examples/users/create-target.md new file mode 100644 index 0000000000..fced935c1b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-target.md @@ -0,0 +1,14 @@ +POST /v1/users/{userId}/targets HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "targetId": "<TARGET_ID>", + "providerType": "email", + "identifier": "<IDENTIFIER>", + "providerId": "<PROVIDER_ID>", + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create-token.md b/docs/examples/1.7.x/server-rest/examples/users/create-token.md new file mode 100644 index 0000000000..4339252660 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create-token.md @@ -0,0 +1,11 @@ +POST /v1/users/{userId}/tokens HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "length": 4, + "expire": 60 +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/create.md b/docs/examples/1.7.x/server-rest/examples/users/create.md new file mode 100644 index 0000000000..67d377255b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/create.md @@ -0,0 +1,14 @@ +POST /v1/users HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "userId": "<USER_ID>", + "email": "email@example.com", + "phone": "+12065550100", + "password": , + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/delete-identity.md b/docs/examples/1.7.x/server-rest/examples/users/delete-identity.md new file mode 100644 index 0000000000..c2aa5eed16 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/delete-identity.md @@ -0,0 +1,7 @@ +DELETE /v1/users/identities/{identityId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-rest/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..9d9e2e950f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,7 @@ +DELETE /v1/users/{userId}/mfa/authenticators/{type} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/users/delete-session.md b/docs/examples/1.7.x/server-rest/examples/users/delete-session.md new file mode 100644 index 0000000000..be204911a2 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/delete-session.md @@ -0,0 +1,7 @@ +DELETE /v1/users/{userId}/sessions/{sessionId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-rest/examples/users/delete-sessions.md new file mode 100644 index 0000000000..54f3a8d4f1 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/delete-sessions.md @@ -0,0 +1,7 @@ +DELETE /v1/users/{userId}/sessions HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/users/delete-target.md b/docs/examples/1.7.x/server-rest/examples/users/delete-target.md new file mode 100644 index 0000000000..77e2c23dd8 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/delete-target.md @@ -0,0 +1,7 @@ +DELETE /v1/users/{userId}/targets/{targetId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/users/delete.md b/docs/examples/1.7.x/server-rest/examples/users/delete.md new file mode 100644 index 0000000000..c31212aa71 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/delete.md @@ -0,0 +1,7 @@ +DELETE /v1/users/{userId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-rest/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..58dd32d2a4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,5 @@ +GET /v1/users/{userId}/mfa/recovery-codes HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/get-prefs.md b/docs/examples/1.7.x/server-rest/examples/users/get-prefs.md new file mode 100644 index 0000000000..ac04cc5c44 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/get-prefs.md @@ -0,0 +1,5 @@ +GET /v1/users/{userId}/prefs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/get-target.md b/docs/examples/1.7.x/server-rest/examples/users/get-target.md new file mode 100644 index 0000000000..2f19db7c7a --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/get-target.md @@ -0,0 +1,5 @@ +GET /v1/users/{userId}/targets/{targetId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/get.md b/docs/examples/1.7.x/server-rest/examples/users/get.md new file mode 100644 index 0000000000..f654676d9b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/get.md @@ -0,0 +1,5 @@ +GET /v1/users/{userId} HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/list-identities.md b/docs/examples/1.7.x/server-rest/examples/users/list-identities.md new file mode 100644 index 0000000000..180a2127a4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/list-identities.md @@ -0,0 +1,5 @@ +GET /v1/users/identities HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/list-logs.md b/docs/examples/1.7.x/server-rest/examples/users/list-logs.md new file mode 100644 index 0000000000..7149f50abe --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/list-logs.md @@ -0,0 +1,5 @@ +GET /v1/users/{userId}/logs HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/list-memberships.md b/docs/examples/1.7.x/server-rest/examples/users/list-memberships.md new file mode 100644 index 0000000000..7d32f2f726 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/list-memberships.md @@ -0,0 +1,5 @@ +GET /v1/users/{userId}/memberships HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-rest/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..a75b26e1c5 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/list-mfa-factors.md @@ -0,0 +1,5 @@ +GET /v1/users/{userId}/mfa/factors HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/list-sessions.md b/docs/examples/1.7.x/server-rest/examples/users/list-sessions.md new file mode 100644 index 0000000000..1ef39b835b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/list-sessions.md @@ -0,0 +1,5 @@ +GET /v1/users/{userId}/sessions HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/list-targets.md b/docs/examples/1.7.x/server-rest/examples/users/list-targets.md new file mode 100644 index 0000000000..e9542c0da0 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/list-targets.md @@ -0,0 +1,5 @@ +GET /v1/users/{userId}/targets HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/list.md b/docs/examples/1.7.x/server-rest/examples/users/list.md new file mode 100644 index 0000000000..a92f71439b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/list.md @@ -0,0 +1,5 @@ +GET /v1/users HTTP/1.1 +Host: cloud.appwrite.io +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-rest/examples/users/update-email-verification.md new file mode 100644 index 0000000000..cf65c72b0c --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-email-verification.md @@ -0,0 +1,10 @@ +PATCH /v1/users/{userId}/verification HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "emailVerification": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-email.md b/docs/examples/1.7.x/server-rest/examples/users/update-email.md new file mode 100644 index 0000000000..10ccafb079 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-email.md @@ -0,0 +1,10 @@ +PATCH /v1/users/{userId}/email HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "email": "email@example.com" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-labels.md b/docs/examples/1.7.x/server-rest/examples/users/update-labels.md new file mode 100644 index 0000000000..f01603f1f4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-labels.md @@ -0,0 +1,10 @@ +PUT /v1/users/{userId}/labels HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "labels": [] +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-rest/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..aa3bb3f6e6 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,7 @@ +PUT /v1/users/{userId}/mfa/recovery-codes HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-mfa.md b/docs/examples/1.7.x/server-rest/examples/users/update-mfa.md new file mode 100644 index 0000000000..fce9198887 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-mfa.md @@ -0,0 +1,10 @@ +PATCH /v1/users/{userId}/mfa HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "mfa": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-name.md b/docs/examples/1.7.x/server-rest/examples/users/update-name.md new file mode 100644 index 0000000000..c8988dfb1d --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-name.md @@ -0,0 +1,10 @@ +PATCH /v1/users/{userId}/name HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-password.md b/docs/examples/1.7.x/server-rest/examples/users/update-password.md new file mode 100644 index 0000000000..fb796d5619 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-password.md @@ -0,0 +1,10 @@ +PATCH /v1/users/{userId}/password HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "password": +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-rest/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..ca3958605b --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-phone-verification.md @@ -0,0 +1,10 @@ +PATCH /v1/users/{userId}/verification/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "phoneVerification": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-phone.md b/docs/examples/1.7.x/server-rest/examples/users/update-phone.md new file mode 100644 index 0000000000..5bc196d668 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-phone.md @@ -0,0 +1,10 @@ +PATCH /v1/users/{userId}/phone HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "number": "+12065550100" +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-prefs.md b/docs/examples/1.7.x/server-rest/examples/users/update-prefs.md new file mode 100644 index 0000000000..1db82743e8 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-prefs.md @@ -0,0 +1,10 @@ +PATCH /v1/users/{userId}/prefs HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "prefs": {} +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-status.md b/docs/examples/1.7.x/server-rest/examples/users/update-status.md new file mode 100644 index 0000000000..6d07f2e15f --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-status.md @@ -0,0 +1,10 @@ +PATCH /v1/users/{userId}/status HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "status": false +} diff --git a/docs/examples/1.7.x/server-rest/examples/users/update-target.md b/docs/examples/1.7.x/server-rest/examples/users/update-target.md new file mode 100644 index 0000000000..926fb166a4 --- /dev/null +++ b/docs/examples/1.7.x/server-rest/examples/users/update-target.md @@ -0,0 +1,12 @@ +PATCH /v1/users/{userId}/targets/{targetId} HTTP/1.1 +Host: cloud.appwrite.io +Content-Type: application/json +X-Appwrite-Response-Format: 1.7.0 +X-Appwrite-Project: <YOUR_PROJECT_ID> +X-Appwrite-Key: <YOUR_API_KEY> + +{ + "identifier": "<IDENTIFIER>", + "providerId": "<PROVIDER_ID>", + "name": "<NAME>" +} diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-ruby/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..bcb25d66f5 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-anonymous-session.md @@ -0,0 +1,11 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create_anonymous_session() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-ruby/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..be5fc1c07a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-email-password-session.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create_email_password_session( + email: 'email@example.com', + password: 'password' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-email-token.md b/docs/examples/1.7.x/server-ruby/examples/account/create-email-token.md new file mode 100644 index 0000000000..d75e310a36 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-email-token.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create_email_token( + user_id: '<USER_ID>', + email: 'email@example.com', + phrase: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-ruby/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..8e5b6b78c8 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-j-w-t.md @@ -0,0 +1,11 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create_jwt() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-ruby/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..9537d1fb3d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create_magic_url_token( + user_id: '<USER_ID>', + email: 'email@example.com', + url: 'https://example.com', # optional + phrase: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-ruby/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..a3cc71cd8a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-mfa-authenticator.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.create_mfa_authenticator( + type: AuthenticatorType::TOTP +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-ruby/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..ba34779ad2 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-mfa-challenge.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create_mfa_challenge( + factor: AuthenticationFactor::EMAIL +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-ruby/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..db91cf533d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.create_mfa_recovery_codes() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-ruby/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..52bc5d6194 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-o-auth2token.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create_o_auth2_token( + provider: OAuthProvider::AMAZON, + success: 'https://example.com', # optional + failure: 'https://example.com', # optional + scopes: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-ruby/examples/account/create-phone-token.md new file mode 100644 index 0000000000..81bedd0ce9 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-phone-token.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create_phone_token( + user_id: '<USER_ID>', + phone: '+12065550100' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-ruby/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..a7dec8f34e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-phone-verification.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.create_phone_verification() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-recovery.md b/docs/examples/1.7.x/server-ruby/examples/account/create-recovery.md new file mode 100644 index 0000000000..e344bafc75 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-recovery.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.create_recovery( + email: 'email@example.com', + url: 'https://example.com' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-session.md b/docs/examples/1.7.x/server-ruby/examples/account/create-session.md new file mode 100644 index 0000000000..4b8ce216bc --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-session.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create_session( + user_id: '<USER_ID>', + secret: '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create-verification.md b/docs/examples/1.7.x/server-ruby/examples/account/create-verification.md new file mode 100644 index 0000000000..2eba7c776d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create-verification.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.create_verification( + url: 'https://example.com' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/create.md b/docs/examples/1.7.x/server-ruby/examples/account/create.md new file mode 100644 index 0000000000..84228b8351 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/create.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.create( + user_id: '<USER_ID>', + email: 'email@example.com', + password: '', + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/delete-identity.md b/docs/examples/1.7.x/server-ruby/examples/account/delete-identity.md new file mode 100644 index 0000000000..e8f8e83814 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/delete-identity.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.delete_identity( + identity_id: '<IDENTITY_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-ruby/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..832ff6ae13 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.delete_mfa_authenticator( + type: AuthenticatorType::TOTP +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/delete-session.md b/docs/examples/1.7.x/server-ruby/examples/account/delete-session.md new file mode 100644 index 0000000000..7496cafe3a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/delete-session.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.delete_session( + session_id: '<SESSION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-ruby/examples/account/delete-sessions.md new file mode 100644 index 0000000000..ca5d922483 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/delete-sessions.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.delete_sessions() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-ruby/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..26ffa9d61d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.get_mfa_recovery_codes() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/get-prefs.md b/docs/examples/1.7.x/server-ruby/examples/account/get-prefs.md new file mode 100644 index 0000000000..664454cf2f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/get-prefs.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.get_prefs() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/get-session.md b/docs/examples/1.7.x/server-ruby/examples/account/get-session.md new file mode 100644 index 0000000000..c433b22e46 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/get-session.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.get_session( + session_id: '<SESSION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/get.md b/docs/examples/1.7.x/server-ruby/examples/account/get.md new file mode 100644 index 0000000000..f33050345d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/get.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.get() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/list-identities.md b/docs/examples/1.7.x/server-ruby/examples/account/list-identities.md new file mode 100644 index 0000000000..696e02dd5a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/list-identities.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.list_identities( + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/list-logs.md b/docs/examples/1.7.x/server-ruby/examples/account/list-logs.md new file mode 100644 index 0000000000..1f3366a2ed --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/list-logs.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.list_logs( + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-ruby/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..460ac87ac1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/list-mfa-factors.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.list_mfa_factors() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/list-sessions.md b/docs/examples/1.7.x/server-ruby/examples/account/list-sessions.md new file mode 100644 index 0000000000..b5968c498f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/list-sessions.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.list_sessions() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-email.md b/docs/examples/1.7.x/server-ruby/examples/account/update-email.md new file mode 100644 index 0000000000..24b43edebd --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-email.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_email( + email: 'email@example.com', + password: 'password' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-ruby/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..b1b50f32fd --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-m-f-a.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_mfa( + mfa: false +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-ruby/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..c96820f183 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.update_magic_url_session( + user_id: '<USER_ID>', + secret: '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-ruby/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..5ff2adcbdc --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-mfa-authenticator.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_mfa_authenticator( + type: AuthenticatorType::TOTP, + otp: '<OTP>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-ruby/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..2f4b61d581 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-mfa-challenge.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_mfa_challenge( + challenge_id: '<CHALLENGE_ID>', + otp: '<OTP>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-ruby/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..ad1f2e5f0e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_mfa_recovery_codes() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-name.md b/docs/examples/1.7.x/server-ruby/examples/account/update-name.md new file mode 100644 index 0000000000..ef8a5cbb4f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-name.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_name( + name: '<NAME>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-password.md b/docs/examples/1.7.x/server-ruby/examples/account/update-password.md new file mode 100644 index 0000000000..4b8705359b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-password.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_password( + password: '', + old_password: 'password' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-ruby/examples/account/update-phone-session.md new file mode 100644 index 0000000000..b81c485c8c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-phone-session.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + +account = Account.new(client) + +result = account.update_phone_session( + user_id: '<USER_ID>', + secret: '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-ruby/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..8dcf316e49 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-phone-verification.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_phone_verification( + user_id: '<USER_ID>', + secret: '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-phone.md b/docs/examples/1.7.x/server-ruby/examples/account/update-phone.md new file mode 100644 index 0000000000..ea758a8d8d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-phone.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_phone( + phone: '+12065550100', + password: 'password' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-prefs.md b/docs/examples/1.7.x/server-ruby/examples/account/update-prefs.md new file mode 100644 index 0000000000..ecfe4f4988 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-prefs.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_prefs( + prefs: {} +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-recovery.md b/docs/examples/1.7.x/server-ruby/examples/account/update-recovery.md new file mode 100644 index 0000000000..42c483771c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-recovery.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_recovery( + user_id: '<USER_ID>', + secret: '<SECRET>', + password: '' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-session.md b/docs/examples/1.7.x/server-ruby/examples/account/update-session.md new file mode 100644 index 0000000000..34e00eec25 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-session.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_session( + session_id: '<SESSION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-status.md b/docs/examples/1.7.x/server-ruby/examples/account/update-status.md new file mode 100644 index 0000000000..5c543b790c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-status.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_status() diff --git a/docs/examples/1.7.x/server-ruby/examples/account/update-verification.md b/docs/examples/1.7.x/server-ruby/examples/account/update-verification.md new file mode 100644 index 0000000000..9866ade95c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/account/update-verification.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +account = Account.new(client) + +result = account.update_verification( + user_id: '<USER_ID>', + secret: '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-ruby/examples/avatars/get-browser.md new file mode 100644 index 0000000000..36354d1dce --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/avatars/get-browser.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +avatars = Avatars.new(client) + +result = avatars.get_browser( + code: Browser::AVANT_BROWSER, + width: 0, # optional + height: 0, # optional + quality: -1 # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-ruby/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..09a0245034 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/avatars/get-credit-card.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +avatars = Avatars.new(client) + +result = avatars.get_credit_card( + code: CreditCard::AMERICAN_EXPRESS, + width: 0, # optional + height: 0, # optional + quality: -1 # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-ruby/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..7c8bd4347f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/avatars/get-favicon.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +avatars = Avatars.new(client) + +result = avatars.get_favicon( + url: 'https://example.com' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-ruby/examples/avatars/get-flag.md new file mode 100644 index 0000000000..61b7793048 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/avatars/get-flag.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +avatars = Avatars.new(client) + +result = avatars.get_flag( + code: Flag::AFGHANISTAN, + width: 0, # optional + height: 0, # optional + quality: -1 # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/avatars/get-image.md b/docs/examples/1.7.x/server-ruby/examples/avatars/get-image.md new file mode 100644 index 0000000000..f46fad0c44 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/avatars/get-image.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +avatars = Avatars.new(client) + +result = avatars.get_image( + url: 'https://example.com', + width: 0, # optional + height: 0 # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-ruby/examples/avatars/get-initials.md new file mode 100644 index 0000000000..85e5a6a422 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/avatars/get-initials.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +avatars = Avatars.new(client) + +result = avatars.get_initials( + name: '<NAME>', # optional + width: 0, # optional + height: 0, # optional + background: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-ruby/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..9c6e34686c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/avatars/get-q-r.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +avatars = Avatars.new(client) + +result = avatars.get_qr( + text: '<TEXT>', + size: 1, # optional + margin: 0, # optional + download: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..158ea05623 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-boolean-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_boolean_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: false, # optional + array: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-collection.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-collection.md new file mode 100644 index 0000000000..c22b34813e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-collection.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_collection( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + name: '<NAME>', + permissions: ["read("any")"], # optional + document_security: false, # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..af12b7965b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-datetime-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_datetime_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: '', # optional + array: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-document.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-document.md new file mode 100644 index 0000000000..ce8dea79ef --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-document.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_session('') # The user session to authenticate with + .set_key('<YOUR_API_KEY>') # Your secret API key + .set_jwt('<YOUR_JWT>') # Your secret JSON Web Token + +databases = Databases.new(client) + +result = databases.create_document( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + document_id: '<DOCUMENT_ID>', + data: {}, + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-documents.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-documents.md new file mode 100644 index 0000000000..469234c91e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-documents.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_documents( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + documents: [] +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..7f36f6b076 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-email-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_email_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: 'email@example.com', # optional + array: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..c8e390a1a9 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-enum-attribute.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_enum_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + elements: [], + required: false, + default: '<DEFAULT>', # optional + array: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..fa77f89902 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-float-attribute.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_float_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + min: null, # optional + max: null, # optional + default: null, # optional + array: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-index.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-index.md new file mode 100644 index 0000000000..18c2f0ee6a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-index.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_index( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + type: IndexType::KEY, + attributes: [], + orders: [], # optional + lengths: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..a689502136 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-integer-attribute.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_integer_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + min: null, # optional + max: null, # optional + default: null, # optional + array: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..7abeee9403 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-ip-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_ip_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: '', # optional + array: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..b056f3bbb2 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-relationship-attribute.md @@ -0,0 +1,22 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_relationship_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + related_collection_id: '<RELATED_COLLECTION_ID>', + type: RelationshipType::ONETOONE, + two_way: false, # optional + key: '', # optional + two_way_key: '', # optional + on_delete: RelationMutate::CASCADE # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..d94af0f22f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-string-attribute.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_string_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + size: 1, + required: false, + default: '<DEFAULT>', # optional + array: false, # optional + encrypt: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..3ffd7321a1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create-url-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create_url_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: 'https://example.com', # optional + array: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/create.md b/docs/examples/1.7.x/server-ruby/examples/databases/create.md new file mode 100644 index 0000000000..62675e6ba7 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/create.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.create( + database_id: '<DATABASE_ID>', + name: '<NAME>', + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..816b31e43f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/delete-attribute.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.delete_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-ruby/examples/databases/delete-collection.md new file mode 100644 index 0000000000..28dd8d773c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/delete-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.delete_collection( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/delete-document.md b/docs/examples/1.7.x/server-ruby/examples/databases/delete-document.md new file mode 100644 index 0000000000..2102d2695b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/delete-document.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +databases = Databases.new(client) + +result = databases.delete_document( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + document_id: '<DOCUMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-ruby/examples/databases/delete-documents.md new file mode 100644 index 0000000000..d0f10d0b41 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/delete-documents.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.delete_documents( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/delete-index.md b/docs/examples/1.7.x/server-ruby/examples/databases/delete-index.md new file mode 100644 index 0000000000..b5d9231508 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/delete-index.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.delete_index( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/delete.md b/docs/examples/1.7.x/server-ruby/examples/databases/delete.md new file mode 100644 index 0000000000..802f5d6bd4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/delete.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.delete( + database_id: '<DATABASE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/get-attribute.md new file mode 100644 index 0000000000..1558de656a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/get-attribute.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.get_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/get-collection.md b/docs/examples/1.7.x/server-ruby/examples/databases/get-collection.md new file mode 100644 index 0000000000..89ae0e32ac --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/get-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.get_collection( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/get-document.md b/docs/examples/1.7.x/server-ruby/examples/databases/get-document.md new file mode 100644 index 0000000000..f43a1a2924 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/get-document.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +databases = Databases.new(client) + +result = databases.get_document( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + document_id: '<DOCUMENT_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/get-index.md b/docs/examples/1.7.x/server-ruby/examples/databases/get-index.md new file mode 100644 index 0000000000..cd5fca3d60 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/get-index.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.get_index( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/get.md b/docs/examples/1.7.x/server-ruby/examples/databases/get.md new file mode 100644 index 0000000000..c042cd7c4e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/get.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.get( + database_id: '<DATABASE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-ruby/examples/databases/list-attributes.md new file mode 100644 index 0000000000..f1ec0dedcd --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/list-attributes.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.list_attributes( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/list-collections.md b/docs/examples/1.7.x/server-ruby/examples/databases/list-collections.md new file mode 100644 index 0000000000..26f3d35552 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/list-collections.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.list_collections( + database_id: '<DATABASE_ID>', + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/list-documents.md b/docs/examples/1.7.x/server-ruby/examples/databases/list-documents.md new file mode 100644 index 0000000000..6617198d3f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/list-documents.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +databases = Databases.new(client) + +result = databases.list_documents( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-ruby/examples/databases/list-indexes.md new file mode 100644 index 0000000000..f98c62a444 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/list-indexes.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.list_indexes( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/list.md b/docs/examples/1.7.x/server-ruby/examples/databases/list.md new file mode 100644 index 0000000000..2e093f73b1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.list( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..72f0eac088 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-boolean-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_boolean_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: false, + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-collection.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-collection.md new file mode 100644 index 0000000000..d42a651cbb --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-collection.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_collection( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + name: '<NAME>', + permissions: ["read("any")"], # optional + document_security: false, # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..b726283323 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-datetime-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_datetime_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: '', + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-document.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-document.md new file mode 100644 index 0000000000..485eb0485a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-document.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +databases = Databases.new(client) + +result = databases.update_document( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + document_id: '<DOCUMENT_ID>', + data: {}, # optional + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-documents.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-documents.md new file mode 100644 index 0000000000..2f6907294f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-documents.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_documents( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + data: {}, # optional + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..3324e39860 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-email-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_email_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: 'email@example.com', + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..72a0515467 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-enum-attribute.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_enum_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + elements: [], + required: false, + default: '<DEFAULT>', + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..738e6de36a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-float-attribute.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_float_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: null, + min: null, # optional + max: null, # optional + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..dece44544f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-integer-attribute.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_integer_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: null, + min: null, # optional + max: null, # optional + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..deceb732e4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-ip-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_ip_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: '', + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..679edb823e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-relationship-attribute.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_relationship_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + on_delete: RelationMutate::CASCADE, # optional + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..66f458e800 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-string-attribute.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_string_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: '<DEFAULT>', + size: 1, # optional + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-ruby/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..cbf417b6bf --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update-url-attribute.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update_url_attribute( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + key: '', + required: false, + default: 'https://example.com', + new_key: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/update.md b/docs/examples/1.7.x/server-ruby/examples/databases/update.md new file mode 100644 index 0000000000..e5c02a11f1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/update.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.update( + database_id: '<DATABASE_ID>', + name: '<NAME>', + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-ruby/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..353e38fe2b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/databases/upsert-documents.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +databases = Databases.new(client) + +result = databases.upsert_documents( + database_id: '<DATABASE_ID>', + collection_id: '<COLLECTION_ID>', + documents: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-ruby/examples/functions/create-deployment.md new file mode 100644 index 0000000000..0ff3db31e9 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/create-deployment.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.create_deployment( + function_id: '<FUNCTION_ID>', + code: InputFile.from_path('dir/file.png'), + activate: false, + entrypoint: '<ENTRYPOINT>', # optional + commands: '<COMMANDS>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-ruby/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..cd432afc95 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.create_duplicate_deployment( + function_id: '<FUNCTION_ID>', + deployment_id: '<DEPLOYMENT_ID>', + build_id: '<BUILD_ID>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/create-execution.md b/docs/examples/1.7.x/server-ruby/examples/functions/create-execution.md new file mode 100644 index 0000000000..b64b1d5c57 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/create-execution.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +functions = Functions.new(client) + +result = functions.create_execution( + function_id: '<FUNCTION_ID>', + body: '<BODY>', # optional + async: false, # optional + path: '<PATH>', # optional + method: ExecutionMethod::GET, # optional + headers: {}, # optional + scheduled_at: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-ruby/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..a447b6e9aa --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/create-template-deployment.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.create_template_deployment( + function_id: '<FUNCTION_ID>', + repository: '<REPOSITORY>', + owner: '<OWNER>', + root_directory: '<ROOT_DIRECTORY>', + version: '<VERSION>', + activate: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/create-variable.md b/docs/examples/1.7.x/server-ruby/examples/functions/create-variable.md new file mode 100644 index 0000000000..3c957d45f8 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/create-variable.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.create_variable( + function_id: '<FUNCTION_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-ruby/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..75bd3c49f5 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/create-vcs-deployment.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.create_vcs_deployment( + function_id: '<FUNCTION_ID>', + type: VCSDeploymentType::BRANCH, + reference: '<REFERENCE>', + activate: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/create.md b/docs/examples/1.7.x/server-ruby/examples/functions/create.md new file mode 100644 index 0000000000..cad021b5f8 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/create.md @@ -0,0 +1,32 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.create( + function_id: '<FUNCTION_ID>', + name: '<NAME>', + runtime: ::NODE_14_5, + execute: ["any"], # optional + events: [], # optional + schedule: '', # optional + timeout: 1, # optional + enabled: false, # optional + logging: false, # optional + entrypoint: '<ENTRYPOINT>', # optional + commands: '<COMMANDS>', # optional + scopes: [], # optional + installation_id: '<INSTALLATION_ID>', # optional + provider_repository_id: '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch: '<PROVIDER_BRANCH>', # optional + provider_silent_mode: false, # optional + provider_root_directory: '<PROVIDER_ROOT_DIRECTORY>', # optional + specification: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-ruby/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..192172cf9c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/delete-deployment.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.delete_deployment( + function_id: '<FUNCTION_ID>', + deployment_id: '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-ruby/examples/functions/delete-execution.md new file mode 100644 index 0000000000..4172aade32 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/delete-execution.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.delete_execution( + function_id: '<FUNCTION_ID>', + execution_id: '<EXECUTION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-ruby/examples/functions/delete-variable.md new file mode 100644 index 0000000000..ffbe69f106 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/delete-variable.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.delete_variable( + function_id: '<FUNCTION_ID>', + variable_id: '<VARIABLE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/delete.md b/docs/examples/1.7.x/server-ruby/examples/functions/delete.md new file mode 100644 index 0000000000..e5c59e39c0 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/delete.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.delete( + function_id: '<FUNCTION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-ruby/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..a1a50a5f94 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/get-deployment-download.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.get_deployment_download( + function_id: '<FUNCTION_ID>', + deployment_id: '<DEPLOYMENT_ID>', + type: DeploymentDownloadType::SOURCE # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-ruby/examples/functions/get-deployment.md new file mode 100644 index 0000000000..1651ae1285 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/get-deployment.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.get_deployment( + function_id: '<FUNCTION_ID>', + deployment_id: '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/get-execution.md b/docs/examples/1.7.x/server-ruby/examples/functions/get-execution.md new file mode 100644 index 0000000000..7ab910e785 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/get-execution.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +functions = Functions.new(client) + +result = functions.get_execution( + function_id: '<FUNCTION_ID>', + execution_id: '<EXECUTION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/get-variable.md b/docs/examples/1.7.x/server-ruby/examples/functions/get-variable.md new file mode 100644 index 0000000000..5022cf84d6 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/get-variable.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.get_variable( + function_id: '<FUNCTION_ID>', + variable_id: '<VARIABLE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/get.md b/docs/examples/1.7.x/server-ruby/examples/functions/get.md new file mode 100644 index 0000000000..5cfd135028 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/get.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.get( + function_id: '<FUNCTION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-ruby/examples/functions/list-deployments.md new file mode 100644 index 0000000000..3df3dd3ee8 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/list-deployments.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.list_deployments( + function_id: '<FUNCTION_ID>', + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/list-executions.md b/docs/examples/1.7.x/server-ruby/examples/functions/list-executions.md new file mode 100644 index 0000000000..57b4ba26bc --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/list-executions.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +functions = Functions.new(client) + +result = functions.list_executions( + function_id: '<FUNCTION_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-ruby/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..1b6d25ee6d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/list-runtimes.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.list_runtimes() diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-ruby/examples/functions/list-specifications.md new file mode 100644 index 0000000000..2c9cf7c470 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/list-specifications.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.list_specifications() diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/list-variables.md b/docs/examples/1.7.x/server-ruby/examples/functions/list-variables.md new file mode 100644 index 0000000000..dd3fc4f2ae --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/list-variables.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.list_variables( + function_id: '<FUNCTION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/list.md b/docs/examples/1.7.x/server-ruby/examples/functions/list.md new file mode 100644 index 0000000000..0cab1c34d7 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.list( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-ruby/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..6664e05079 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/update-deployment-status.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.update_deployment_status( + function_id: '<FUNCTION_ID>', + deployment_id: '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-ruby/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..68c5d7fdfd --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/update-function-deployment.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.update_function_deployment( + function_id: '<FUNCTION_ID>', + deployment_id: '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/update-variable.md b/docs/examples/1.7.x/server-ruby/examples/functions/update-variable.md new file mode 100644 index 0000000000..7c4e402820 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/update-variable.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.update_variable( + function_id: '<FUNCTION_ID>', + variable_id: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', # optional + secret: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/functions/update.md b/docs/examples/1.7.x/server-ruby/examples/functions/update.md new file mode 100644 index 0000000000..45b6e32ab3 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/functions/update.md @@ -0,0 +1,31 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +functions = Functions.new(client) + +result = functions.update( + function_id: '<FUNCTION_ID>', + name: '<NAME>', + runtime: ::NODE_14_5, # optional + execute: ["any"], # optional + events: [], # optional + schedule: '', # optional + timeout: 1, # optional + enabled: false, # optional + logging: false, # optional + entrypoint: '<ENTRYPOINT>', # optional + commands: '<COMMANDS>', # optional + scopes: [], # optional + installation_id: '<INSTALLATION_ID>', # optional + provider_repository_id: '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch: '<PROVIDER_BRANCH>', # optional + provider_silent_mode: false, # optional + provider_root_directory: '<PROVIDER_ROOT_DIRECTORY>', # optional + specification: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/graphql/mutation.md b/docs/examples/1.7.x/server-ruby/examples/graphql/mutation.md new file mode 100644 index 0000000000..08ca6f30d2 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/graphql/mutation.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +graphql = Graphql.new(client) + +result = graphql.mutation( + query: {} +) diff --git a/docs/examples/1.7.x/server-ruby/examples/graphql/query.md b/docs/examples/1.7.x/server-ruby/examples/graphql/query.md new file mode 100644 index 0000000000..05e69506a1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/graphql/query.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +graphql = Graphql.new(client) + +result = graphql.query( + query: {} +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-ruby/examples/health/get-antivirus.md new file mode 100644 index 0000000000..5f8d06056d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-antivirus.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_antivirus() diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-cache.md b/docs/examples/1.7.x/server-ruby/examples/health/get-cache.md new file mode 100644 index 0000000000..01bd46cd0b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-cache.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_cache() diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-certificate.md b/docs/examples/1.7.x/server-ruby/examples/health/get-certificate.md new file mode 100644 index 0000000000..64699d42d0 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-certificate.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_certificate( + domain: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-d-b.md b/docs/examples/1.7.x/server-ruby/examples/health/get-d-b.md new file mode 100644 index 0000000000..d9668339c5 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-d-b.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_db() diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-ruby/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..73e1983e3a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-failed-jobs.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_failed_jobs( + name: ::V1_DATABASE, + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-ruby/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..86e9c409ed --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-pub-sub.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_pub_sub() diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..9f876982ef --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-builds.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_builds( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..d10c2feb39 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-certificates.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_certificates( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..37024d8144 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-databases.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_databases( + name: '<NAME>', # optional + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..2508be22ba --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-deletes.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_deletes( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..e5b56474bc --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-functions.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_functions( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..cb35ac333b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-logs.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_logs( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..36cfec3d87 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-mails.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_mails( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..d317f2a74c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-messaging.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_messaging( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..3c68c865dc --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-migrations.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_migrations( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..7024bac307 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-stats-resources.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_stats_resources( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..b687bd8789 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-usage.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_usage( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..28f28ea78a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-queue-webhooks.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_queue_webhooks( + threshold: null # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-ruby/examples/health/get-storage-local.md new file mode 100644 index 0000000000..a122de50ee --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-storage-local.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_storage_local() diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-storage.md b/docs/examples/1.7.x/server-ruby/examples/health/get-storage.md new file mode 100644 index 0000000000..ee778643ec --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-storage.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_storage() diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get-time.md b/docs/examples/1.7.x/server-ruby/examples/health/get-time.md new file mode 100644 index 0000000000..9d345557a3 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get-time.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get_time() diff --git a/docs/examples/1.7.x/server-ruby/examples/health/get.md b/docs/examples/1.7.x/server-ruby/examples/health/get.md new file mode 100644 index 0000000000..4bbf0c0eb0 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/health/get.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +health = Health.new(client) + +result = health.get() diff --git a/docs/examples/1.7.x/server-ruby/examples/locale/get.md b/docs/examples/1.7.x/server-ruby/examples/locale/get.md new file mode 100644 index 0000000000..264da0e187 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/locale/get.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +locale = Locale.new(client) + +result = locale.get() diff --git a/docs/examples/1.7.x/server-ruby/examples/locale/list-codes.md b/docs/examples/1.7.x/server-ruby/examples/locale/list-codes.md new file mode 100644 index 0000000000..27632669f0 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/locale/list-codes.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +locale = Locale.new(client) + +result = locale.list_codes() diff --git a/docs/examples/1.7.x/server-ruby/examples/locale/list-continents.md b/docs/examples/1.7.x/server-ruby/examples/locale/list-continents.md new file mode 100644 index 0000000000..b78f130201 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/locale/list-continents.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +locale = Locale.new(client) + +result = locale.list_continents() diff --git a/docs/examples/1.7.x/server-ruby/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-ruby/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..8498f2bdda --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/locale/list-countries-e-u.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +locale = Locale.new(client) + +result = locale.list_countries_eu() diff --git a/docs/examples/1.7.x/server-ruby/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-ruby/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..8fa087e920 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/locale/list-countries-phones.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +locale = Locale.new(client) + +result = locale.list_countries_phones() diff --git a/docs/examples/1.7.x/server-ruby/examples/locale/list-countries.md b/docs/examples/1.7.x/server-ruby/examples/locale/list-countries.md new file mode 100644 index 0000000000..a635a4e0b3 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/locale/list-countries.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +locale = Locale.new(client) + +result = locale.list_countries() diff --git a/docs/examples/1.7.x/server-ruby/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-ruby/examples/locale/list-currencies.md new file mode 100644 index 0000000000..60e9d94df9 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/locale/list-currencies.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +locale = Locale.new(client) + +result = locale.list_currencies() diff --git a/docs/examples/1.7.x/server-ruby/examples/locale/list-languages.md b/docs/examples/1.7.x/server-ruby/examples/locale/list-languages.md new file mode 100644 index 0000000000..e5b9df1945 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/locale/list-languages.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +locale = Locale.new(client) + +result = locale.list_languages() diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..a280340847 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-apns-provider.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_apns_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + auth_key: '<AUTH_KEY>', # optional + auth_key_id: '<AUTH_KEY_ID>', # optional + team_id: '<TEAM_ID>', # optional + bundle_id: '<BUNDLE_ID>', # optional + sandbox: false, # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-email.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-email.md new file mode 100644 index 0000000000..573a5b83d4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-email.md @@ -0,0 +1,25 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_email( + message_id: '<MESSAGE_ID>', + subject: '<SUBJECT>', + content: '<CONTENT>', + topics: [], # optional + users: [], # optional + targets: [], # optional + cc: [], # optional + bcc: [], # optional + attachments: [], # optional + draft: false, # optional + html: false, # optional + scheduled_at: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..a1e8b67b51 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-fcm-provider.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_fcm_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + service_account_json: {}, # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..aa5b7f1899 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,23 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_mailgun_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + api_key: '<API_KEY>', # optional + domain: '<DOMAIN>', # optional + is_eu_region: false, # optional + from_name: '<FROM_NAME>', # optional + from_email: 'email@example.com', # optional + reply_to_name: '<REPLY_TO_NAME>', # optional + reply_to_email: 'email@example.com', # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..35a192f148 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-msg91provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_msg91_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + template_id: '<TEMPLATE_ID>', # optional + sender_id: '<SENDER_ID>', # optional + auth_key: '<AUTH_KEY>', # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-push.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-push.md new file mode 100644 index 0000000000..5c58fa542b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-push.md @@ -0,0 +1,32 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_push( + message_id: '<MESSAGE_ID>', + title: '<TITLE>', # optional + body: '<BODY>', # optional + topics: [], # optional + users: [], # optional + targets: [], # optional + data: {}, # optional + action: '<ACTION>', # optional + image: '[ID1:ID2]', # optional + icon: '<ICON>', # optional + sound: '<SOUND>', # optional + color: '<COLOR>', # optional + tag: '<TAG>', # optional + badge: null, # optional + draft: false, # optional + scheduled_at: '', # optional + content_available: false, # optional + critical: false, # optional + priority: MessagePriority::NORMAL # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..eae3ad3ece --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_sendgrid_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + api_key: '<API_KEY>', # optional + from_name: '<FROM_NAME>', # optional + from_email: 'email@example.com', # optional + reply_to_name: '<REPLY_TO_NAME>', # optional + reply_to_email: 'email@example.com', # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-sms.md new file mode 100644 index 0000000000..901ec40c05 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-sms.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_sms( + message_id: '<MESSAGE_ID>', + content: '<CONTENT>', + topics: [], # optional + users: [], # optional + targets: [], # optional + draft: false, # optional + scheduled_at: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..b062e574b4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-smtp-provider.md @@ -0,0 +1,27 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_smtp_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + host: '<HOST>', + port: 1, # optional + username: '<USERNAME>', # optional + password: '<PASSWORD>', # optional + encryption: SmtpEncryption::NONE, # optional + auto_tls: false, # optional + mailer: '<MAILER>', # optional + from_name: '<FROM_NAME>', # optional + from_email: 'email@example.com', # optional + reply_to_name: '<REPLY_TO_NAME>', # optional + reply_to_email: 'email@example.com', # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..1f6fa43736 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-subscriber.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_jwt('<YOUR_JWT>') # Your secret JSON Web Token + +messaging = Messaging.new(client) + +result = messaging.create_subscriber( + topic_id: '<TOPIC_ID>', + subscriber_id: '<SUBSCRIBER_ID>', + target_id: '<TARGET_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..b26d9d2784 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-telesign-provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_telesign_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', # optional + customer_id: '<CUSTOMER_ID>', # optional + api_key: '<API_KEY>', # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..4fd1a3683e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_textmagic_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', # optional + username: '<USERNAME>', # optional + api_key: '<API_KEY>', # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-topic.md new file mode 100644 index 0000000000..da2cf5e57b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-topic.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_topic( + topic_id: '<TOPIC_ID>', + name: '<NAME>', + subscribe: ["any"] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..a945602646 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-twilio-provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_twilio_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', # optional + account_sid: '<ACCOUNT_SID>', # optional + auth_token: '<AUTH_TOKEN>', # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..5a5f6eb72b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/create-vonage-provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.create_vonage_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', + from: '+12065550100', # optional + api_key: '<API_KEY>', # optional + api_secret: '<API_SECRET>', # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..3c19e1ba0f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/delete-provider.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.delete_provider( + provider_id: '<PROVIDER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-ruby/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..a82e5e94c2 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/delete-subscriber.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_jwt('<YOUR_JWT>') # Your secret JSON Web Token + +messaging = Messaging.new(client) + +result = messaging.delete_subscriber( + topic_id: '<TOPIC_ID>', + subscriber_id: '<SUBSCRIBER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-ruby/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..cb58ee5c6c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/delete-topic.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.delete_topic( + topic_id: '<TOPIC_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/delete.md b/docs/examples/1.7.x/server-ruby/examples/messaging/delete.md new file mode 100644 index 0000000000..e3db26127d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/delete.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.delete( + message_id: '<MESSAGE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/get-message.md b/docs/examples/1.7.x/server-ruby/examples/messaging/get-message.md new file mode 100644 index 0000000000..f5449a0be4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/get-message.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.get_message( + message_id: '<MESSAGE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/get-provider.md new file mode 100644 index 0000000000..ddb28da4de --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/get-provider.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.get_provider( + provider_id: '<PROVIDER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-ruby/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..3c7d05334e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/get-subscriber.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.get_subscriber( + topic_id: '<TOPIC_ID>', + subscriber_id: '<SUBSCRIBER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-ruby/examples/messaging/get-topic.md new file mode 100644 index 0000000000..9ff732fc26 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/get-topic.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.get_topic( + topic_id: '<TOPIC_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-ruby/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..f20d6fb491 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/list-message-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.list_message_logs( + message_id: '<MESSAGE_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-ruby/examples/messaging/list-messages.md new file mode 100644 index 0000000000..ffc5dcdbc6 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/list-messages.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.list_messages( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-ruby/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..af3751a18f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/list-provider-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.list_provider_logs( + provider_id: '<PROVIDER_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-ruby/examples/messaging/list-providers.md new file mode 100644 index 0000000000..a857f0562f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/list-providers.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.list_providers( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-ruby/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..06550e7067 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.list_subscriber_logs( + subscriber_id: '<SUBSCRIBER_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-ruby/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..07ebc99bab --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/list-subscribers.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.list_subscribers( + topic_id: '<TOPIC_ID>', + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-ruby/examples/messaging/list-targets.md new file mode 100644 index 0000000000..0407255d86 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/list-targets.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.list_targets( + message_id: '<MESSAGE_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-ruby/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..9b53c47f82 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/list-topic-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.list_topic_logs( + topic_id: '<TOPIC_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-ruby/examples/messaging/list-topics.md new file mode 100644 index 0000000000..5e7b6740cc --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/list-topics.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.list_topics( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..b19704aaed --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-apns-provider.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_apns_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + enabled: false, # optional + auth_key: '<AUTH_KEY>', # optional + auth_key_id: '<AUTH_KEY_ID>', # optional + team_id: '<TEAM_ID>', # optional + bundle_id: '<BUNDLE_ID>', # optional + sandbox: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-email.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-email.md new file mode 100644 index 0000000000..aa3593292f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-email.md @@ -0,0 +1,25 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_email( + message_id: '<MESSAGE_ID>', + topics: [], # optional + users: [], # optional + targets: [], # optional + subject: '<SUBJECT>', # optional + content: '<CONTENT>', # optional + draft: false, # optional + html: false, # optional + cc: [], # optional + bcc: [], # optional + scheduled_at: '', # optional + attachments: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..44ea0d28de --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-fcm-provider.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_fcm_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + enabled: false, # optional + service_account_json: {} # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..a2e53190d7 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,23 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_mailgun_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + api_key: '<API_KEY>', # optional + domain: '<DOMAIN>', # optional + is_eu_region: false, # optional + enabled: false, # optional + from_name: '<FROM_NAME>', # optional + from_email: 'email@example.com', # optional + reply_to_name: '<REPLY_TO_NAME>', # optional + reply_to_email: '<REPLY_TO_EMAIL>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..0e88382850 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-msg91provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_msg91_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + enabled: false, # optional + template_id: '<TEMPLATE_ID>', # optional + sender_id: '<SENDER_ID>', # optional + auth_key: '<AUTH_KEY>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-push.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-push.md new file mode 100644 index 0000000000..42a5104ccb --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-push.md @@ -0,0 +1,32 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_push( + message_id: '<MESSAGE_ID>', + topics: [], # optional + users: [], # optional + targets: [], # optional + title: '<TITLE>', # optional + body: '<BODY>', # optional + data: {}, # optional + action: '<ACTION>', # optional + image: '[ID1:ID2]', # optional + icon: '<ICON>', # optional + sound: '<SOUND>', # optional + color: '<COLOR>', # optional + tag: '<TAG>', # optional + badge: null, # optional + draft: false, # optional + scheduled_at: '', # optional + content_available: false, # optional + critical: false, # optional + priority: MessagePriority::NORMAL # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..99f1a9c7f1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,21 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_sendgrid_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + enabled: false, # optional + api_key: '<API_KEY>', # optional + from_name: '<FROM_NAME>', # optional + from_email: 'email@example.com', # optional + reply_to_name: '<REPLY_TO_NAME>', # optional + reply_to_email: '<REPLY_TO_EMAIL>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-sms.md new file mode 100644 index 0000000000..b31480c1a0 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-sms.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_sms( + message_id: '<MESSAGE_ID>', + topics: [], # optional + users: [], # optional + targets: [], # optional + content: '<CONTENT>', # optional + draft: false, # optional + scheduled_at: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..bbaebf3c32 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-smtp-provider.md @@ -0,0 +1,27 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_smtp_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + host: '<HOST>', # optional + port: 1, # optional + username: '<USERNAME>', # optional + password: '<PASSWORD>', # optional + encryption: SmtpEncryption::NONE, # optional + auto_tls: false, # optional + mailer: '<MAILER>', # optional + from_name: '<FROM_NAME>', # optional + from_email: 'email@example.com', # optional + reply_to_name: '<REPLY_TO_NAME>', # optional + reply_to_email: '<REPLY_TO_EMAIL>', # optional + enabled: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..4f1bf6ff5b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-telesign-provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_telesign_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + enabled: false, # optional + customer_id: '<CUSTOMER_ID>', # optional + api_key: '<API_KEY>', # optional + from: '<FROM>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..c8cd2f0daf --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_textmagic_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + enabled: false, # optional + username: '<USERNAME>', # optional + api_key: '<API_KEY>', # optional + from: '<FROM>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-topic.md new file mode 100644 index 0000000000..d20d945385 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-topic.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_topic( + topic_id: '<TOPIC_ID>', + name: '<NAME>', # optional + subscribe: ["any"] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..0f6a6761e1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-twilio-provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_twilio_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + enabled: false, # optional + account_sid: '<ACCOUNT_SID>', # optional + auth_token: '<AUTH_TOKEN>', # optional + from: '<FROM>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-ruby/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..e75bfbd98e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/messaging/update-vonage-provider.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +messaging = Messaging.new(client) + +result = messaging.update_vonage_provider( + provider_id: '<PROVIDER_ID>', + name: '<NAME>', # optional + enabled: false, # optional + api_key: '<API_KEY>', # optional + api_secret: '<API_SECRET>', # optional + from: '<FROM>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-ruby/examples/sites/create-deployment.md new file mode 100644 index 0000000000..b392b8679a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/create-deployment.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.create_deployment( + site_id: '<SITE_ID>', + code: InputFile.from_path('dir/file.png'), + activate: false, + install_command: '<INSTALL_COMMAND>', # optional + build_command: '<BUILD_COMMAND>', # optional + output_directory: '<OUTPUT_DIRECTORY>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-ruby/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..f72b7a641b --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.create_duplicate_deployment( + site_id: '<SITE_ID>', + deployment_id: '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-ruby/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..7df9665590 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/create-template-deployment.md @@ -0,0 +1,19 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.create_template_deployment( + site_id: '<SITE_ID>', + repository: '<REPOSITORY>', + owner: '<OWNER>', + root_directory: '<ROOT_DIRECTORY>', + version: '<VERSION>', + activate: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/create-variable.md b/docs/examples/1.7.x/server-ruby/examples/sites/create-variable.md new file mode 100644 index 0000000000..4d2031f8ea --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/create-variable.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.create_variable( + site_id: '<SITE_ID>', + key: '<KEY>', + value: '<VALUE>', + secret: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-ruby/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..2e72b6e3f1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/create-vcs-deployment.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.create_vcs_deployment( + site_id: '<SITE_ID>', + type: VCSDeploymentType::BRANCH, + reference: '<REFERENCE>', + activate: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/create.md b/docs/examples/1.7.x/server-ruby/examples/sites/create.md new file mode 100644 index 0000000000..2243185485 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/create.md @@ -0,0 +1,32 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.create( + site_id: '<SITE_ID>', + name: '<NAME>', + framework: ::ANALOG, + build_runtime: ::NODE_14_5, + enabled: false, # optional + logging: false, # optional + timeout: 1, # optional + install_command: '<INSTALL_COMMAND>', # optional + build_command: '<BUILD_COMMAND>', # optional + output_directory: '<OUTPUT_DIRECTORY>', # optional + adapter: ::STATIC, # optional + installation_id: '<INSTALLATION_ID>', # optional + fallback_file: '<FALLBACK_FILE>', # optional + provider_repository_id: '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch: '<PROVIDER_BRANCH>', # optional + provider_silent_mode: false, # optional + provider_root_directory: '<PROVIDER_ROOT_DIRECTORY>', # optional + specification: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-ruby/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..6f96e05023 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/delete-deployment.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.delete_deployment( + site_id: '<SITE_ID>', + deployment_id: '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/delete-log.md b/docs/examples/1.7.x/server-ruby/examples/sites/delete-log.md new file mode 100644 index 0000000000..556f3e2855 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/delete-log.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.delete_log( + site_id: '<SITE_ID>', + log_id: '<LOG_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-ruby/examples/sites/delete-variable.md new file mode 100644 index 0000000000..ca5e51b2b9 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/delete-variable.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.delete_variable( + site_id: '<SITE_ID>', + variable_id: '<VARIABLE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/delete.md b/docs/examples/1.7.x/server-ruby/examples/sites/delete.md new file mode 100644 index 0000000000..e92d6428e1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/delete.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.delete( + site_id: '<SITE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-ruby/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..85162626ba --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/get-deployment-download.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.get_deployment_download( + site_id: '<SITE_ID>', + deployment_id: '<DEPLOYMENT_ID>', + type: DeploymentDownloadType::SOURCE # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-ruby/examples/sites/get-deployment.md new file mode 100644 index 0000000000..79f47e4aad --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/get-deployment.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.get_deployment( + site_id: '<SITE_ID>', + deployment_id: '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/get-log.md b/docs/examples/1.7.x/server-ruby/examples/sites/get-log.md new file mode 100644 index 0000000000..2e5e8c2d4c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/get-log.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.get_log( + site_id: '<SITE_ID>', + log_id: '<LOG_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/get-variable.md b/docs/examples/1.7.x/server-ruby/examples/sites/get-variable.md new file mode 100644 index 0000000000..ac27efcd50 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/get-variable.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.get_variable( + site_id: '<SITE_ID>', + variable_id: '<VARIABLE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/get.md b/docs/examples/1.7.x/server-ruby/examples/sites/get.md new file mode 100644 index 0000000000..a8d3aac1b4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/get.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.get( + site_id: '<SITE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-ruby/examples/sites/list-deployments.md new file mode 100644 index 0000000000..8571f8561a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/list-deployments.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.list_deployments( + site_id: '<SITE_ID>', + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-ruby/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..61f18fbf6f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/list-frameworks.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.list_frameworks() diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/list-logs.md b/docs/examples/1.7.x/server-ruby/examples/sites/list-logs.md new file mode 100644 index 0000000000..919be968c9 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/list-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.list_logs( + site_id: '<SITE_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-ruby/examples/sites/list-specifications.md new file mode 100644 index 0000000000..42f41157fb --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/list-specifications.md @@ -0,0 +1,12 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.list_specifications() diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/list-variables.md b/docs/examples/1.7.x/server-ruby/examples/sites/list-variables.md new file mode 100644 index 0000000000..cf10fa4628 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/list-variables.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.list_variables( + site_id: '<SITE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/list.md b/docs/examples/1.7.x/server-ruby/examples/sites/list.md new file mode 100644 index 0000000000..ba70205236 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.list( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-ruby/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..859ad22b61 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/update-deployment-status.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.update_deployment_status( + site_id: '<SITE_ID>', + deployment_id: '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-ruby/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..bc033e931e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/update-site-deployment.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.update_site_deployment( + site_id: '<SITE_ID>', + deployment_id: '<DEPLOYMENT_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/update-variable.md b/docs/examples/1.7.x/server-ruby/examples/sites/update-variable.md new file mode 100644 index 0000000000..e61f129573 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/update-variable.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.update_variable( + site_id: '<SITE_ID>', + variable_id: '<VARIABLE_ID>', + key: '<KEY>', + value: '<VALUE>', # optional + secret: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/sites/update.md b/docs/examples/1.7.x/server-ruby/examples/sites/update.md new file mode 100644 index 0000000000..922255ab65 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/sites/update.md @@ -0,0 +1,32 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +sites = Sites.new(client) + +result = sites.update( + site_id: '<SITE_ID>', + name: '<NAME>', + framework: ::ANALOG, + enabled: false, # optional + logging: false, # optional + timeout: 1, # optional + install_command: '<INSTALL_COMMAND>', # optional + build_command: '<BUILD_COMMAND>', # optional + output_directory: '<OUTPUT_DIRECTORY>', # optional + build_runtime: ::NODE_14_5, # optional + adapter: ::STATIC, # optional + fallback_file: '<FALLBACK_FILE>', # optional + installation_id: '<INSTALLATION_ID>', # optional + provider_repository_id: '<PROVIDER_REPOSITORY_ID>', # optional + provider_branch: '<PROVIDER_BRANCH>', # optional + provider_silent_mode: false, # optional + provider_root_directory: '<PROVIDER_ROOT_DIRECTORY>', # optional + specification: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-ruby/examples/storage/create-bucket.md new file mode 100644 index 0000000000..643431ed2c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/create-bucket.md @@ -0,0 +1,23 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage.new(client) + +result = storage.create_bucket( + bucket_id: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], # optional + file_security: false, # optional + enabled: false, # optional + maximum_file_size: 1, # optional + allowed_file_extensions: [], # optional + compression: ::NONE, # optional + encryption: false, # optional + antivirus: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/create-file.md b/docs/examples/1.7.x/server-ruby/examples/storage/create-file.md new file mode 100644 index 0000000000..99e07c33f4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/create-file.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +storage = Storage.new(client) + +result = storage.create_file( + bucket_id: '<BUCKET_ID>', + file_id: '<FILE_ID>', + file: InputFile.from_path('dir/file.png'), + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-ruby/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..dda3264e66 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/delete-bucket.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage.new(client) + +result = storage.delete_bucket( + bucket_id: '<BUCKET_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/delete-file.md b/docs/examples/1.7.x/server-ruby/examples/storage/delete-file.md new file mode 100644 index 0000000000..eef058857c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/delete-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +storage = Storage.new(client) + +result = storage.delete_file( + bucket_id: '<BUCKET_ID>', + file_id: '<FILE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-ruby/examples/storage/get-bucket.md new file mode 100644 index 0000000000..7c8580dcaf --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/get-bucket.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage.new(client) + +result = storage.get_bucket( + bucket_id: '<BUCKET_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-ruby/examples/storage/get-file-download.md new file mode 100644 index 0000000000..7b7075184a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/get-file-download.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +storage = Storage.new(client) + +result = storage.get_file_download( + bucket_id: '<BUCKET_ID>', + file_id: '<FILE_ID>', + token: '<TOKEN>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-ruby/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..23254615d3 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/get-file-preview.md @@ -0,0 +1,27 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +storage = Storage.new(client) + +result = storage.get_file_preview( + bucket_id: '<BUCKET_ID>', + file_id: '<FILE_ID>', + width: 0, # optional + height: 0, # optional + gravity: ImageGravity::CENTER, # optional + quality: -1, # optional + border_width: 0, # optional + border_color: '', # optional + border_radius: 0, # optional + opacity: 0, # optional + rotation: -360, # optional + background: '', # optional + output: ImageFormat::JPG, # optional + token: '<TOKEN>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-ruby/examples/storage/get-file-view.md new file mode 100644 index 0000000000..c9e9952f05 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/get-file-view.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +storage = Storage.new(client) + +result = storage.get_file_view( + bucket_id: '<BUCKET_ID>', + file_id: '<FILE_ID>', + token: '<TOKEN>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/get-file.md b/docs/examples/1.7.x/server-ruby/examples/storage/get-file.md new file mode 100644 index 0000000000..b816bdba02 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/get-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +storage = Storage.new(client) + +result = storage.get_file( + bucket_id: '<BUCKET_ID>', + file_id: '<FILE_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-ruby/examples/storage/list-buckets.md new file mode 100644 index 0000000000..dfee831b69 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/list-buckets.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage.new(client) + +result = storage.list_buckets( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/list-files.md b/docs/examples/1.7.x/server-ruby/examples/storage/list-files.md new file mode 100644 index 0000000000..078ff55e41 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/list-files.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +storage = Storage.new(client) + +result = storage.list_files( + bucket_id: '<BUCKET_ID>', + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-ruby/examples/storage/update-bucket.md new file mode 100644 index 0000000000..09b915eb5f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/update-bucket.md @@ -0,0 +1,23 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +storage = Storage.new(client) + +result = storage.update_bucket( + bucket_id: '<BUCKET_ID>', + name: '<NAME>', + permissions: ["read("any")"], # optional + file_security: false, # optional + enabled: false, # optional + maximum_file_size: 1, # optional + allowed_file_extensions: [], # optional + compression: ::NONE, # optional + encryption: false, # optional + antivirus: false # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/storage/update-file.md b/docs/examples/1.7.x/server-ruby/examples/storage/update-file.md new file mode 100644 index 0000000000..a454499d9d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/storage/update-file.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +storage = Storage.new(client) + +result = storage.update_file( + bucket_id: '<BUCKET_ID>', + file_id: '<FILE_ID>', + name: '<NAME>', # optional + permissions: ["read("any")"] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/create-membership.md b/docs/examples/1.7.x/server-ruby/examples/teams/create-membership.md new file mode 100644 index 0000000000..6c0faba77d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/create-membership.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.create_membership( + team_id: '<TEAM_ID>', + roles: [], + email: 'email@example.com', # optional + user_id: '<USER_ID>', # optional + phone: '+12065550100', # optional + url: 'https://example.com', # optional + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/create.md b/docs/examples/1.7.x/server-ruby/examples/teams/create.md new file mode 100644 index 0000000000..ba71a1dfc4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/create.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.create( + team_id: '<TEAM_ID>', + name: '<NAME>', + roles: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-ruby/examples/teams/delete-membership.md new file mode 100644 index 0000000000..5d815a8ca3 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/delete-membership.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.delete_membership( + team_id: '<TEAM_ID>', + membership_id: '<MEMBERSHIP_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/delete.md b/docs/examples/1.7.x/server-ruby/examples/teams/delete.md new file mode 100644 index 0000000000..c9f7c400e9 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/delete.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.delete( + team_id: '<TEAM_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/get-membership.md b/docs/examples/1.7.x/server-ruby/examples/teams/get-membership.md new file mode 100644 index 0000000000..41a2c7bfb4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/get-membership.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.get_membership( + team_id: '<TEAM_ID>', + membership_id: '<MEMBERSHIP_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-ruby/examples/teams/get-prefs.md new file mode 100644 index 0000000000..e6b2cfadce --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/get-prefs.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.get_prefs( + team_id: '<TEAM_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/get.md b/docs/examples/1.7.x/server-ruby/examples/teams/get.md new file mode 100644 index 0000000000..af51193cd3 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/get.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.get( + team_id: '<TEAM_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-ruby/examples/teams/list-memberships.md new file mode 100644 index 0000000000..db48f0cfc6 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/list-memberships.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.list_memberships( + team_id: '<TEAM_ID>', + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/list.md b/docs/examples/1.7.x/server-ruby/examples/teams/list.md new file mode 100644 index 0000000000..9e96391975 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.list( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-ruby/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..40d82b86f1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/update-membership-status.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.update_membership_status( + team_id: '<TEAM_ID>', + membership_id: '<MEMBERSHIP_ID>', + user_id: '<USER_ID>', + secret: '<SECRET>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/update-membership.md b/docs/examples/1.7.x/server-ruby/examples/teams/update-membership.md new file mode 100644 index 0000000000..92b69b1773 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/update-membership.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.update_membership( + team_id: '<TEAM_ID>', + membership_id: '<MEMBERSHIP_ID>', + roles: [] +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/update-name.md b/docs/examples/1.7.x/server-ruby/examples/teams/update-name.md new file mode 100644 index 0000000000..74f785c4ca --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/update-name.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.update_name( + team_id: '<TEAM_ID>', + name: '<NAME>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-ruby/examples/teams/update-prefs.md new file mode 100644 index 0000000000..03426aa3b9 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/teams/update-prefs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_session('') # The user session to authenticate with + +teams = Teams.new(client) + +result = teams.update_prefs( + team_id: '<TEAM_ID>', + prefs: {} +) diff --git a/docs/examples/1.7.x/server-ruby/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-ruby/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..8c432c5255 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/tokens/create-file-token.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens.new(client) + +result = tokens.create_file_token( + bucket_id: '<BUCKET_ID>', + file_id: '<FILE_ID>', + expire: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/tokens/delete.md b/docs/examples/1.7.x/server-ruby/examples/tokens/delete.md new file mode 100644 index 0000000000..cb59147f42 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/tokens/delete.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens.new(client) + +result = tokens.delete( + token_id: '<TOKEN_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/tokens/get.md b/docs/examples/1.7.x/server-ruby/examples/tokens/get.md new file mode 100644 index 0000000000..ef87c74294 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/tokens/get.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens.new(client) + +result = tokens.get( + token_id: '<TOKEN_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/tokens/list.md b/docs/examples/1.7.x/server-ruby/examples/tokens/list.md new file mode 100644 index 0000000000..4932f04151 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/tokens/list.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens.new(client) + +result = tokens.list( + bucket_id: '<BUCKET_ID>', + file_id: '<FILE_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/tokens/update.md b/docs/examples/1.7.x/server-ruby/examples/tokens/update.md new file mode 100644 index 0000000000..91713730fb --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/tokens/update.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +tokens = Tokens.new(client) + +result = tokens.update( + token_id: '<TOKEN_ID>', + expire: '' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-ruby/examples/users/create-argon2user.md new file mode 100644 index 0000000000..8da9e0b1ff --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-argon2user.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_argon2_user( + user_id: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-ruby/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..7c2b852d69 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-bcrypt-user.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_bcrypt_user( + user_id: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-ruby/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..57f7f1d32f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-j-w-t.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_jwt( + user_id: '<USER_ID>', + session_id: '<SESSION_ID>', # optional + duration: 0 # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-ruby/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..63fb68742e --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-m-d5user.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_md5_user( + user_id: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-ruby/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..0cdea46af3 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_mfa_recovery_codes( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-ruby/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..7cd898a6fc --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-p-h-pass-user.md @@ -0,0 +1,17 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_ph_pass_user( + user_id: '<USER_ID>', + email: 'email@example.com', + password: 'password', + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-ruby/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..f3951d9c80 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-s-h-a-user.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_sha_user( + user_id: '<USER_ID>', + email: 'email@example.com', + password: 'password', + password_version: PasswordHash::SHA1, # optional + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-ruby/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..d84c2eed48 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_scrypt_modified_user( + user_id: '<USER_ID>', + email: 'email@example.com', + password: 'password', + password_salt: '<PASSWORD_SALT>', + password_salt_separator: '<PASSWORD_SALT_SEPARATOR>', + password_signer_key: '<PASSWORD_SIGNER_KEY>', + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-ruby/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..53aa253d2a --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-scrypt-user.md @@ -0,0 +1,22 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_scrypt_user( + user_id: '<USER_ID>', + email: 'email@example.com', + password: 'password', + password_salt: '<PASSWORD_SALT>', + password_cpu: null, + password_memory: null, + password_parallel: null, + password_length: null, + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-session.md b/docs/examples/1.7.x/server-ruby/examples/users/create-session.md new file mode 100644 index 0000000000..32d2b5f2ad --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-session.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_session( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-target.md b/docs/examples/1.7.x/server-ruby/examples/users/create-target.md new file mode 100644 index 0000000000..3e87868df6 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-target.md @@ -0,0 +1,20 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_target( + user_id: '<USER_ID>', + target_id: '<TARGET_ID>', + provider_type: MessagingProviderType::EMAIL, + identifier: '<IDENTIFIER>', + provider_id: '<PROVIDER_ID>', # optional + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create-token.md b/docs/examples/1.7.x/server-ruby/examples/users/create-token.md new file mode 100644 index 0000000000..85e5f448ca --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create-token.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create_token( + user_id: '<USER_ID>', + length: 4, # optional + expire: 60 # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/create.md b/docs/examples/1.7.x/server-ruby/examples/users/create.md new file mode 100644 index 0000000000..4f57adeb87 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/create.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.create( + user_id: '<USER_ID>', + email: 'email@example.com', # optional + phone: '+12065550100', # optional + password: '', # optional + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/delete-identity.md b/docs/examples/1.7.x/server-ruby/examples/users/delete-identity.md new file mode 100644 index 0000000000..d2482dfae1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/delete-identity.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.delete_identity( + identity_id: '<IDENTITY_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-ruby/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..50fcb0fa0d --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite +include Appwrite::Enums + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.delete_mfa_authenticator( + user_id: '<USER_ID>', + type: AuthenticatorType::TOTP +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/delete-session.md b/docs/examples/1.7.x/server-ruby/examples/users/delete-session.md new file mode 100644 index 0000000000..9b14cc4fa3 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/delete-session.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.delete_session( + user_id: '<USER_ID>', + session_id: '<SESSION_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-ruby/examples/users/delete-sessions.md new file mode 100644 index 0000000000..23fd505763 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/delete-sessions.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.delete_sessions( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/delete-target.md b/docs/examples/1.7.x/server-ruby/examples/users/delete-target.md new file mode 100644 index 0000000000..f1564024db --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/delete-target.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.delete_target( + user_id: '<USER_ID>', + target_id: '<TARGET_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/delete.md b/docs/examples/1.7.x/server-ruby/examples/users/delete.md new file mode 100644 index 0000000000..db7f2ee6f8 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/delete.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.delete( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-ruby/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..f984517d26 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.get_mfa_recovery_codes( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/get-prefs.md b/docs/examples/1.7.x/server-ruby/examples/users/get-prefs.md new file mode 100644 index 0000000000..0118b39897 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/get-prefs.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.get_prefs( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/get-target.md b/docs/examples/1.7.x/server-ruby/examples/users/get-target.md new file mode 100644 index 0000000000..10ce49b229 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/get-target.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.get_target( + user_id: '<USER_ID>', + target_id: '<TARGET_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/get.md b/docs/examples/1.7.x/server-ruby/examples/users/get.md new file mode 100644 index 0000000000..95865b7e6c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/get.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.get( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/list-identities.md b/docs/examples/1.7.x/server-ruby/examples/users/list-identities.md new file mode 100644 index 0000000000..78c8cf5098 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/list-identities.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.list_identities( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/list-logs.md b/docs/examples/1.7.x/server-ruby/examples/users/list-logs.md new file mode 100644 index 0000000000..686434869c --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/list-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.list_logs( + user_id: '<USER_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/list-memberships.md b/docs/examples/1.7.x/server-ruby/examples/users/list-memberships.md new file mode 100644 index 0000000000..a4c3aa11d2 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/list-memberships.md @@ -0,0 +1,16 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.list_memberships( + user_id: '<USER_ID>', + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-ruby/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..ca1e2b2b96 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/list-mfa-factors.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.list_mfa_factors( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/list-sessions.md b/docs/examples/1.7.x/server-ruby/examples/users/list-sessions.md new file mode 100644 index 0000000000..311420531f --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/list-sessions.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.list_sessions( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/list-targets.md b/docs/examples/1.7.x/server-ruby/examples/users/list-targets.md new file mode 100644 index 0000000000..aae9941794 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/list-targets.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.list_targets( + user_id: '<USER_ID>', + queries: [] # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/list.md b/docs/examples/1.7.x/server-ruby/examples/users/list.md new file mode 100644 index 0000000000..b490b65099 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.list( + queries: [], # optional + search: '<SEARCH>' # optional +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-ruby/examples/users/update-email-verification.md new file mode 100644 index 0000000000..07f85f0318 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-email-verification.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_email_verification( + user_id: '<USER_ID>', + email_verification: false +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-email.md b/docs/examples/1.7.x/server-ruby/examples/users/update-email.md new file mode 100644 index 0000000000..b36aac59d1 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-email.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_email( + user_id: '<USER_ID>', + email: 'email@example.com' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-labels.md b/docs/examples/1.7.x/server-ruby/examples/users/update-labels.md new file mode 100644 index 0000000000..a62d34b2e2 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-labels.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_labels( + user_id: '<USER_ID>', + labels: [] +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-ruby/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..aaf5ba16c0 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,14 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_mfa_recovery_codes( + user_id: '<USER_ID>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-mfa.md b/docs/examples/1.7.x/server-ruby/examples/users/update-mfa.md new file mode 100644 index 0000000000..3ebfb96116 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-mfa.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_mfa( + user_id: '<USER_ID>', + mfa: false +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-name.md b/docs/examples/1.7.x/server-ruby/examples/users/update-name.md new file mode 100644 index 0000000000..e7ade96e32 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-name.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_name( + user_id: '<USER_ID>', + name: '<NAME>' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-password.md b/docs/examples/1.7.x/server-ruby/examples/users/update-password.md new file mode 100644 index 0000000000..47c1f1ef49 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-password.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_password( + user_id: '<USER_ID>', + password: '' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-ruby/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..6af7fcb638 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-phone-verification.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_phone_verification( + user_id: '<USER_ID>', + phone_verification: false +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-phone.md b/docs/examples/1.7.x/server-ruby/examples/users/update-phone.md new file mode 100644 index 0000000000..bd26547daa --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-phone.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_phone( + user_id: '<USER_ID>', + number: '+12065550100' +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-prefs.md b/docs/examples/1.7.x/server-ruby/examples/users/update-prefs.md new file mode 100644 index 0000000000..fbdccd7d23 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-prefs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_prefs( + user_id: '<USER_ID>', + prefs: {} +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-status.md b/docs/examples/1.7.x/server-ruby/examples/users/update-status.md new file mode 100644 index 0000000000..d73982c149 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-status.md @@ -0,0 +1,15 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_status( + user_id: '<USER_ID>', + status: false +) diff --git a/docs/examples/1.7.x/server-ruby/examples/users/update-target.md b/docs/examples/1.7.x/server-ruby/examples/users/update-target.md new file mode 100644 index 0000000000..dbcd1bd2f4 --- /dev/null +++ b/docs/examples/1.7.x/server-ruby/examples/users/update-target.md @@ -0,0 +1,18 @@ +require 'appwrite' + +include Appwrite + +client = Client.new + .set_endpoint('https://<REGION>.cloud.appwrite.io/v1') # Your API Endpoint + .set_project('<YOUR_PROJECT_ID>') # Your project ID + .set_key('<YOUR_API_KEY>') # Your secret API key + +users = Users.new(client) + +result = users.update_target( + user_id: '<USER_ID>', + target_id: '<TARGET_ID>', + identifier: '<IDENTIFIER>', # optional + provider_id: '<PROVIDER_ID>', # optional + name: '<NAME>' # optional +) diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-anonymous-session.md b/docs/examples/1.7.x/server-swift/examples/account/create-anonymous-session.md new file mode 100644 index 0000000000..22020a16d9 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-anonymous-session.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let session = try await account.createAnonymousSession() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-email-password-session.md b/docs/examples/1.7.x/server-swift/examples/account/create-email-password-session.md new file mode 100644 index 0000000000..5f541a8a15 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-email-password-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let session = try await account.createEmailPasswordSession( + email: "email@example.com", + password: "password" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-email-token.md b/docs/examples/1.7.x/server-swift/examples/account/create-email-token.md new file mode 100644 index 0000000000..cf82afde8f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-email-token.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let token = try await account.createEmailToken( + userId: "<USER_ID>", + email: "email@example.com", + phrase: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-j-w-t.md b/docs/examples/1.7.x/server-swift/examples/account/create-j-w-t.md new file mode 100644 index 0000000000..fbcd50401c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-j-w-t.md @@ -0,0 +1,10 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let jwt = try await account.createJWT() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-magic-u-r-l-token.md b/docs/examples/1.7.x/server-swift/examples/account/create-magic-u-r-l-token.md new file mode 100644 index 0000000000..27bbe4137e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-magic-u-r-l-token.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let token = try await account.createMagicURLToken( + userId: "<USER_ID>", + email: "email@example.com", + url: "https://example.com", // optional + phrase: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-mfa-authenticator.md b/docs/examples/1.7.x/server-swift/examples/account/create-mfa-authenticator.md new file mode 100644 index 0000000000..4dd91d84dd --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-mfa-authenticator.md @@ -0,0 +1,14 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let mfaType = try await account.createMfaAuthenticator( + type: .totp +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-mfa-challenge.md b/docs/examples/1.7.x/server-swift/examples/account/create-mfa-challenge.md new file mode 100644 index 0000000000..0b5d385999 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-mfa-challenge.md @@ -0,0 +1,13 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let mfaChallenge = try await account.createMfaChallenge( + factor: .email +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-swift/examples/account/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..a73e4f6024 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let mfaRecoveryCodes = try await account.createMfaRecoveryCodes() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-o-auth2token.md b/docs/examples/1.7.x/server-swift/examples/account/create-o-auth2token.md new file mode 100644 index 0000000000..21b54e8c9a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-o-auth2token.md @@ -0,0 +1,16 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let success = try await account.createOAuth2Token( + provider: .amazon, + success: "https://example.com", // optional + failure: "https://example.com", // optional + scopes: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-phone-token.md b/docs/examples/1.7.x/server-swift/examples/account/create-phone-token.md new file mode 100644 index 0000000000..12b2d4b223 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-phone-token.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let token = try await account.createPhoneToken( + userId: "<USER_ID>", + phone: "+12065550100" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-phone-verification.md b/docs/examples/1.7.x/server-swift/examples/account/create-phone-verification.md new file mode 100644 index 0000000000..cba0637648 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-phone-verification.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let token = try await account.createPhoneVerification() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-recovery.md b/docs/examples/1.7.x/server-swift/examples/account/create-recovery.md new file mode 100644 index 0000000000..d89f679e0c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-recovery.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let token = try await account.createRecovery( + email: "email@example.com", + url: "https://example.com" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-session.md b/docs/examples/1.7.x/server-swift/examples/account/create-session.md new file mode 100644 index 0000000000..2065692a16 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let session = try await account.createSession( + userId: "<USER_ID>", + secret: "<SECRET>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create-verification.md b/docs/examples/1.7.x/server-swift/examples/account/create-verification.md new file mode 100644 index 0000000000..71e9bdd32b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create-verification.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let token = try await account.createVerification( + url: "https://example.com" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/create.md b/docs/examples/1.7.x/server-swift/examples/account/create.md new file mode 100644 index 0000000000..79b4db64ba --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/create.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let user = try await account.create( + userId: "<USER_ID>", + email: "email@example.com", + password: "", + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/delete-identity.md b/docs/examples/1.7.x/server-swift/examples/account/delete-identity.md new file mode 100644 index 0000000000..f0f14b37d2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/delete-identity.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let result = try await account.deleteIdentity( + identityId: "<IDENTITY_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-swift/examples/account/delete-mfa-authenticator.md new file mode 100644 index 0000000000..e4209a2550 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/delete-mfa-authenticator.md @@ -0,0 +1,14 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let result = try await account.deleteMfaAuthenticator( + type: .totp +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/delete-session.md b/docs/examples/1.7.x/server-swift/examples/account/delete-session.md new file mode 100644 index 0000000000..2469620116 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/delete-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let result = try await account.deleteSession( + sessionId: "<SESSION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/delete-sessions.md b/docs/examples/1.7.x/server-swift/examples/account/delete-sessions.md new file mode 100644 index 0000000000..da8ac6dfe8 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/delete-sessions.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let result = try await account.deleteSessions() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-swift/examples/account/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..69455f4acd --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/get-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let mfaRecoveryCodes = try await account.getMfaRecoveryCodes() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/get-prefs.md b/docs/examples/1.7.x/server-swift/examples/account/get-prefs.md new file mode 100644 index 0000000000..6551df92e6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/get-prefs.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let preferences = try await account.getPrefs() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/get-session.md b/docs/examples/1.7.x/server-swift/examples/account/get-session.md new file mode 100644 index 0000000000..63efb3f098 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/get-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let session = try await account.getSession( + sessionId: "<SESSION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/get.md b/docs/examples/1.7.x/server-swift/examples/account/get.md new file mode 100644 index 0000000000..833901b5b4 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/get.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let user = try await account.get() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/list-identities.md b/docs/examples/1.7.x/server-swift/examples/account/list-identities.md new file mode 100644 index 0000000000..c7ecff9962 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/list-identities.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let identityList = try await account.listIdentities( + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/list-logs.md b/docs/examples/1.7.x/server-swift/examples/account/list-logs.md new file mode 100644 index 0000000000..84c3327762 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/list-logs.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let logList = try await account.listLogs( + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/list-mfa-factors.md b/docs/examples/1.7.x/server-swift/examples/account/list-mfa-factors.md new file mode 100644 index 0000000000..a63d4d0f82 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/list-mfa-factors.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let mfaFactors = try await account.listMfaFactors() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/list-sessions.md b/docs/examples/1.7.x/server-swift/examples/account/list-sessions.md new file mode 100644 index 0000000000..49691b3a9e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/list-sessions.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let sessionList = try await account.listSessions() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-email.md b/docs/examples/1.7.x/server-swift/examples/account/update-email.md new file mode 100644 index 0000000000..48cce5055d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-email.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let user = try await account.updateEmail( + email: "email@example.com", + password: "password" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-m-f-a.md b/docs/examples/1.7.x/server-swift/examples/account/update-m-f-a.md new file mode 100644 index 0000000000..ac486fceb6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-m-f-a.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let user = try await account.updateMFA( + mfa: false +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-magic-u-r-l-session.md b/docs/examples/1.7.x/server-swift/examples/account/update-magic-u-r-l-session.md new file mode 100644 index 0000000000..507006b230 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-magic-u-r-l-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let session = try await account.updateMagicURLSession( + userId: "<USER_ID>", + secret: "<SECRET>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-mfa-authenticator.md b/docs/examples/1.7.x/server-swift/examples/account/update-mfa-authenticator.md new file mode 100644 index 0000000000..fedbc954af --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-mfa-authenticator.md @@ -0,0 +1,15 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let user = try await account.updateMfaAuthenticator( + type: .totp, + otp: "<OTP>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-mfa-challenge.md b/docs/examples/1.7.x/server-swift/examples/account/update-mfa-challenge.md new file mode 100644 index 0000000000..4edb1fbbc3 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-mfa-challenge.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let session = try await account.updateMfaChallenge( + challengeId: "<CHALLENGE_ID>", + otp: "<OTP>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-swift/examples/account/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..d0a2b8c686 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-mfa-recovery-codes.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let mfaRecoveryCodes = try await account.updateMfaRecoveryCodes() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-name.md b/docs/examples/1.7.x/server-swift/examples/account/update-name.md new file mode 100644 index 0000000000..2c676d8714 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-name.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let user = try await account.updateName( + name: "<NAME>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-password.md b/docs/examples/1.7.x/server-swift/examples/account/update-password.md new file mode 100644 index 0000000000..62fe48e6e9 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-password.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let user = try await account.updatePassword( + password: "", + oldPassword: "password" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-phone-session.md b/docs/examples/1.7.x/server-swift/examples/account/update-phone-session.md new file mode 100644 index 0000000000..f6776d1de1 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-phone-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + +let account = Account(client) + +let session = try await account.updatePhoneSession( + userId: "<USER_ID>", + secret: "<SECRET>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-phone-verification.md b/docs/examples/1.7.x/server-swift/examples/account/update-phone-verification.md new file mode 100644 index 0000000000..a983e79c3c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-phone-verification.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let token = try await account.updatePhoneVerification( + userId: "<USER_ID>", + secret: "<SECRET>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-phone.md b/docs/examples/1.7.x/server-swift/examples/account/update-phone.md new file mode 100644 index 0000000000..6dd87a0ce5 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-phone.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let user = try await account.updatePhone( + phone: "+12065550100", + password: "password" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-prefs.md b/docs/examples/1.7.x/server-swift/examples/account/update-prefs.md new file mode 100644 index 0000000000..53bf623469 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-prefs.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let user = try await account.updatePrefs( + prefs: [:] +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-recovery.md b/docs/examples/1.7.x/server-swift/examples/account/update-recovery.md new file mode 100644 index 0000000000..d655edfe59 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-recovery.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let token = try await account.updateRecovery( + userId: "<USER_ID>", + secret: "<SECRET>", + password: "" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-session.md b/docs/examples/1.7.x/server-swift/examples/account/update-session.md new file mode 100644 index 0000000000..f2f4f7b737 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let session = try await account.updateSession( + sessionId: "<SESSION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-status.md b/docs/examples/1.7.x/server-swift/examples/account/update-status.md new file mode 100644 index 0000000000..88e30cfb09 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-status.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let user = try await account.updateStatus() + diff --git a/docs/examples/1.7.x/server-swift/examples/account/update-verification.md b/docs/examples/1.7.x/server-swift/examples/account/update-verification.md new file mode 100644 index 0000000000..61bc18cc48 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/account/update-verification.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let account = Account(client) + +let token = try await account.updateVerification( + userId: "<USER_ID>", + secret: "<SECRET>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/avatars/get-browser.md b/docs/examples/1.7.x/server-swift/examples/avatars/get-browser.md new file mode 100644 index 0000000000..1c105c280c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/avatars/get-browser.md @@ -0,0 +1,17 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let avatars = Avatars(client) + +let bytes = try await avatars.getBrowser( + code: .avantBrowser, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/avatars/get-credit-card.md b/docs/examples/1.7.x/server-swift/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..af7c2800be --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/avatars/get-credit-card.md @@ -0,0 +1,17 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let avatars = Avatars(client) + +let bytes = try await avatars.getCreditCard( + code: .americanExpress, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/avatars/get-favicon.md b/docs/examples/1.7.x/server-swift/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..73f54fe5d3 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/avatars/get-favicon.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let avatars = Avatars(client) + +let bytes = try await avatars.getFavicon( + url: "https://example.com" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/avatars/get-flag.md b/docs/examples/1.7.x/server-swift/examples/avatars/get-flag.md new file mode 100644 index 0000000000..e33cbb0c7f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/avatars/get-flag.md @@ -0,0 +1,17 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let avatars = Avatars(client) + +let bytes = try await avatars.getFlag( + code: .afghanistan, + width: 0, // optional + height: 0, // optional + quality: -1 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/avatars/get-image.md b/docs/examples/1.7.x/server-swift/examples/avatars/get-image.md new file mode 100644 index 0000000000..5455ad18f5 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/avatars/get-image.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let avatars = Avatars(client) + +let bytes = try await avatars.getImage( + url: "https://example.com", + width: 0, // optional + height: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/avatars/get-initials.md b/docs/examples/1.7.x/server-swift/examples/avatars/get-initials.md new file mode 100644 index 0000000000..63dfa5e5ab --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let avatars = Avatars(client) + +let bytes = try await avatars.getInitials( + name: "<NAME>", // optional + width: 0, // optional + height: 0, // optional + background: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/avatars/get-q-r.md b/docs/examples/1.7.x/server-swift/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..ae4cc910ab --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/avatars/get-q-r.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let avatars = Avatars(client) + +let bytes = try await avatars.getQR( + text: "<TEXT>", + size: 1, // optional + margin: 0, // optional + download: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-boolean-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-boolean-attribute.md new file mode 100644 index 0000000000..4530c385ca --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-boolean-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeBoolean = try await databases.createBooleanAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: false, // optional + array: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-collection.md b/docs/examples/1.7.x/server-swift/examples/databases/create-collection.md new file mode 100644 index 0000000000..c3335b48cb --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-collection.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let collection = try await databases.createCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + name: "<NAME>", + permissions: ["read("any")"], // optional + documentSecurity: false, // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-datetime-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-datetime-attribute.md new file mode 100644 index 0000000000..d14d0b5cab --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-datetime-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeDatetime = try await databases.createDatetimeAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", // optional + array: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-document.md b/docs/examples/1.7.x/server-swift/examples/databases/create-document.md new file mode 100644 index 0000000000..4ee21048ab --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-document.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setSession("") // The user session to authenticate with + .setKey("<YOUR_API_KEY>") // Your secret API key + .setJWT("<YOUR_JWT>") // Your secret JSON Web Token + +let databases = Databases(client) + +let document = try await databases.createDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>", + data: [:], + permissions: ["read("any")"] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-documents.md b/docs/examples/1.7.x/server-swift/examples/databases/create-documents.md new file mode 100644 index 0000000000..39a58ab3fd --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-documents.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let documentList = try await databases.createDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documents: [] +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-email-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-email-attribute.md new file mode 100644 index 0000000000..9bd30b38c9 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-email-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeEmail = try await databases.createEmailAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "email@example.com", // optional + array: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-enum-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-enum-attribute.md new file mode 100644 index 0000000000..08023f652b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-enum-attribute.md @@ -0,0 +1,19 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeEnum = try await databases.createEnumAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + elements: [], + required: false, + default: "<DEFAULT>", // optional + array: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-float-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-float-attribute.md new file mode 100644 index 0000000000..b5126c6a50 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-float-attribute.md @@ -0,0 +1,20 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeFloat = try await databases.createFloatAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + min: 0, // optional + max: 0, // optional + default: 0, // optional + array: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-index.md b/docs/examples/1.7.x/server-swift/examples/databases/create-index.md new file mode 100644 index 0000000000..7e9a6205d7 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-index.md @@ -0,0 +1,20 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let index = try await databases.createIndex( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + type: .key, + attributes: [], + orders: [], // optional + lengths: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-integer-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-integer-attribute.md new file mode 100644 index 0000000000..20c29cd569 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-integer-attribute.md @@ -0,0 +1,20 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeInteger = try await databases.createIntegerAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + min: 0, // optional + max: 0, // optional + default: 0, // optional + array: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-ip-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-ip-attribute.md new file mode 100644 index 0000000000..09605ba522 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-ip-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeIp = try await databases.createIpAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", // optional + array: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-relationship-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-relationship-attribute.md new file mode 100644 index 0000000000..8e6c3eb84b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-relationship-attribute.md @@ -0,0 +1,21 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeRelationship = try await databases.createRelationshipAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + relatedCollectionId: "<RELATED_COLLECTION_ID>", + type: .oneToOne, + twoWay: false, // optional + key: "", // optional + twoWayKey: "", // optional + onDelete: .cascade // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-string-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-string-attribute.md new file mode 100644 index 0000000000..80c321ecdb --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-string-attribute.md @@ -0,0 +1,20 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeString = try await databases.createStringAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + size: 1, + required: false, + default: "<DEFAULT>", // optional + array: false, // optional + encrypt: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create-url-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/create-url-attribute.md new file mode 100644 index 0000000000..efd2acbc08 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create-url-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeUrl = try await databases.createUrlAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "https://example.com", // optional + array: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/create.md b/docs/examples/1.7.x/server-swift/examples/databases/create.md new file mode 100644 index 0000000000..b0362bb3e8 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/create.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let database = try await databases.create( + databaseId: "<DATABASE_ID>", + name: "<NAME>", + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/delete-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/delete-attribute.md new file mode 100644 index 0000000000..9948555981 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/delete-attribute.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let result = try await databases.deleteAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/delete-collection.md b/docs/examples/1.7.x/server-swift/examples/databases/delete-collection.md new file mode 100644 index 0000000000..d61f0e658d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/delete-collection.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let result = try await databases.deleteCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/delete-document.md b/docs/examples/1.7.x/server-swift/examples/databases/delete-document.md new file mode 100644 index 0000000000..1db59709ab --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/delete-document.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let databases = Databases(client) + +let result = try await databases.deleteDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/delete-documents.md b/docs/examples/1.7.x/server-swift/examples/databases/delete-documents.md new file mode 100644 index 0000000000..d5321f2b26 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/delete-documents.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let documentList = try await databases.deleteDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/delete-index.md b/docs/examples/1.7.x/server-swift/examples/databases/delete-index.md new file mode 100644 index 0000000000..ecd09f7ce6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/delete-index.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let result = try await databases.deleteIndex( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/delete.md b/docs/examples/1.7.x/server-swift/examples/databases/delete.md new file mode 100644 index 0000000000..40567e4288 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/delete.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let result = try await databases.delete( + databaseId: "<DATABASE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/get-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/get-attribute.md new file mode 100644 index 0000000000..30cd0c8832 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/get-attribute.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let result = try await databases.getAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/get-collection.md b/docs/examples/1.7.x/server-swift/examples/databases/get-collection.md new file mode 100644 index 0000000000..96c1fa0f94 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/get-collection.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let collection = try await databases.getCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/get-document.md b/docs/examples/1.7.x/server-swift/examples/databases/get-document.md new file mode 100644 index 0000000000..c92856a731 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/get-document.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let databases = Databases(client) + +let document = try await databases.getDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/get-index.md b/docs/examples/1.7.x/server-swift/examples/databases/get-index.md new file mode 100644 index 0000000000..cd59074dc8 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/get-index.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let index = try await databases.getIndex( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/get.md b/docs/examples/1.7.x/server-swift/examples/databases/get.md new file mode 100644 index 0000000000..875929bed0 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/get.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let database = try await databases.get( + databaseId: "<DATABASE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/list-attributes.md b/docs/examples/1.7.x/server-swift/examples/databases/list-attributes.md new file mode 100644 index 0000000000..b375c8771b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/list-attributes.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeList = try await databases.listAttributes( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/list-collections.md b/docs/examples/1.7.x/server-swift/examples/databases/list-collections.md new file mode 100644 index 0000000000..10481d985c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/list-collections.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let collectionList = try await databases.listCollections( + databaseId: "<DATABASE_ID>", + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/list-documents.md b/docs/examples/1.7.x/server-swift/examples/databases/list-documents.md new file mode 100644 index 0000000000..2cac9330b3 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/list-documents.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let databases = Databases(client) + +let documentList = try await databases.listDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/list-indexes.md b/docs/examples/1.7.x/server-swift/examples/databases/list-indexes.md new file mode 100644 index 0000000000..691f74b076 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/list-indexes.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let indexList = try await databases.listIndexes( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/list.md b/docs/examples/1.7.x/server-swift/examples/databases/list.md new file mode 100644 index 0000000000..f8a2313acc --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/list.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let databaseList = try await databases.list( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-boolean-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-boolean-attribute.md new file mode 100644 index 0000000000..0d925056c2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-boolean-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeBoolean = try await databases.updateBooleanAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: false, + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-collection.md b/docs/examples/1.7.x/server-swift/examples/databases/update-collection.md new file mode 100644 index 0000000000..9109990109 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-collection.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let collection = try await databases.updateCollection( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + name: "<NAME>", + permissions: ["read("any")"], // optional + documentSecurity: false, // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-datetime-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-datetime-attribute.md new file mode 100644 index 0000000000..906b374946 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-datetime-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeDatetime = try await databases.updateDatetimeAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-document.md b/docs/examples/1.7.x/server-swift/examples/databases/update-document.md new file mode 100644 index 0000000000..7d452db284 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-document.md @@ -0,0 +1,17 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let databases = Databases(client) + +let document = try await databases.updateDocument( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documentId: "<DOCUMENT_ID>", + data: [:], // optional + permissions: ["read("any")"] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-documents.md b/docs/examples/1.7.x/server-swift/examples/databases/update-documents.md new file mode 100644 index 0000000000..0e934b1424 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-documents.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let documentList = try await databases.updateDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + data: [:], // optional + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-email-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-email-attribute.md new file mode 100644 index 0000000000..b485712ada --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-email-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeEmail = try await databases.updateEmailAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "email@example.com", + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-enum-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-enum-attribute.md new file mode 100644 index 0000000000..997b940c1b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-enum-attribute.md @@ -0,0 +1,19 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeEnum = try await databases.updateEnumAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + elements: [], + required: false, + default: "<DEFAULT>", + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-float-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-float-attribute.md new file mode 100644 index 0000000000..5f3e8da4da --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-float-attribute.md @@ -0,0 +1,20 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeFloat = try await databases.updateFloatAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: 0, + min: 0, // optional + max: 0, // optional + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-integer-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-integer-attribute.md new file mode 100644 index 0000000000..edc0a12c8c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-integer-attribute.md @@ -0,0 +1,20 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeInteger = try await databases.updateIntegerAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: 0, + min: 0, // optional + max: 0, // optional + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-ip-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-ip-attribute.md new file mode 100644 index 0000000000..e08835747c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-ip-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeIp = try await databases.updateIpAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "", + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-relationship-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-relationship-attribute.md new file mode 100644 index 0000000000..0fb06d7796 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-relationship-attribute.md @@ -0,0 +1,18 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeRelationship = try await databases.updateRelationshipAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + onDelete: .cascade, // optional + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-string-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-string-attribute.md new file mode 100644 index 0000000000..1eb3315dca --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-string-attribute.md @@ -0,0 +1,19 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeString = try await databases.updateStringAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "<DEFAULT>", + size: 1, // optional + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update-url-attribute.md b/docs/examples/1.7.x/server-swift/examples/databases/update-url-attribute.md new file mode 100644 index 0000000000..cd18f96368 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update-url-attribute.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let attributeUrl = try await databases.updateUrlAttribute( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + key: "", + required: false, + default: "https://example.com", + newKey: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/update.md b/docs/examples/1.7.x/server-swift/examples/databases/update.md new file mode 100644 index 0000000000..07f506257b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/update.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let database = try await databases.update( + databaseId: "<DATABASE_ID>", + name: "<NAME>", + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/databases/upsert-documents.md b/docs/examples/1.7.x/server-swift/examples/databases/upsert-documents.md new file mode 100644 index 0000000000..353cc5c502 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/databases/upsert-documents.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let databases = Databases(client) + +let documentList = try await databases.upsertDocuments( + databaseId: "<DATABASE_ID>", + collectionId: "<COLLECTION_ID>", + documents: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/create-deployment.md b/docs/examples/1.7.x/server-swift/examples/functions/create-deployment.md new file mode 100644 index 0000000000..de3d14d242 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/create-deployment.md @@ -0,0 +1,17 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let deployment = try await functions.createDeployment( + functionId: "<FUNCTION_ID>", + code: InputFile.fromPath("file.png"), + activate: false, + entrypoint: "<ENTRYPOINT>", // optional + commands: "<COMMANDS>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/create-duplicate-deployment.md b/docs/examples/1.7.x/server-swift/examples/functions/create-duplicate-deployment.md new file mode 100644 index 0000000000..cadf67aa65 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/create-duplicate-deployment.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let deployment = try await functions.createDuplicateDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>", + buildId: "<BUILD_ID>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/create-execution.md b/docs/examples/1.7.x/server-swift/examples/functions/create-execution.md new file mode 100644 index 0000000000..aae7a0f52f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/create-execution.md @@ -0,0 +1,20 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let functions = Functions(client) + +let execution = try await functions.createExecution( + functionId: "<FUNCTION_ID>", + body: "<BODY>", // optional + async: false, // optional + path: "<PATH>", // optional + method: .gET, // optional + headers: [:], // optional + scheduledAt: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/create-template-deployment.md b/docs/examples/1.7.x/server-swift/examples/functions/create-template-deployment.md new file mode 100644 index 0000000000..27c5311c7a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/create-template-deployment.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let deployment = try await functions.createTemplateDeployment( + functionId: "<FUNCTION_ID>", + repository: "<REPOSITORY>", + owner: "<OWNER>", + rootDirectory: "<ROOT_DIRECTORY>", + version: "<VERSION>", + activate: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/create-variable.md b/docs/examples/1.7.x/server-swift/examples/functions/create-variable.md new file mode 100644 index 0000000000..d792c678e6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/create-variable.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let variable = try await functions.createVariable( + functionId: "<FUNCTION_ID>", + key: "<KEY>", + value: "<VALUE>", + secret: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/create-vcs-deployment.md b/docs/examples/1.7.x/server-swift/examples/functions/create-vcs-deployment.md new file mode 100644 index 0000000000..5586722aab --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/create-vcs-deployment.md @@ -0,0 +1,17 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let deployment = try await functions.createVcsDeployment( + functionId: "<FUNCTION_ID>", + type: .branch, + reference: "<REFERENCE>", + activate: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/create.md b/docs/examples/1.7.x/server-swift/examples/functions/create.md new file mode 100644 index 0000000000..6f17a65b93 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/create.md @@ -0,0 +1,31 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let function = try await functions.create( + functionId: "<FUNCTION_ID>", + name: "<NAME>", + runtime: .node145, + execute: ["any"], // optional + events: [], // optional + schedule: "", // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: "<ENTRYPOINT>", // optional + commands: "<COMMANDS>", // optional + scopes: [], // optional + installationId: "<INSTALLATION_ID>", // optional + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch: "<PROVIDER_BRANCH>", // optional + providerSilentMode: false, // optional + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", // optional + specification: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/delete-deployment.md b/docs/examples/1.7.x/server-swift/examples/functions/delete-deployment.md new file mode 100644 index 0000000000..dec7b1db8f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/delete-deployment.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let result = try await functions.deleteDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/delete-execution.md b/docs/examples/1.7.x/server-swift/examples/functions/delete-execution.md new file mode 100644 index 0000000000..e51b7dcd5c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/delete-execution.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let result = try await functions.deleteExecution( + functionId: "<FUNCTION_ID>", + executionId: "<EXECUTION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/delete-variable.md b/docs/examples/1.7.x/server-swift/examples/functions/delete-variable.md new file mode 100644 index 0000000000..ea0ebab079 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/delete-variable.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let result = try await functions.deleteVariable( + functionId: "<FUNCTION_ID>", + variableId: "<VARIABLE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/delete.md b/docs/examples/1.7.x/server-swift/examples/functions/delete.md new file mode 100644 index 0000000000..76bb48cddf --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/delete.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let result = try await functions.delete( + functionId: "<FUNCTION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/get-deployment-download.md b/docs/examples/1.7.x/server-swift/examples/functions/get-deployment-download.md new file mode 100644 index 0000000000..1feab0f484 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/get-deployment-download.md @@ -0,0 +1,16 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let bytes = try await functions.getDeploymentDownload( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>", + type: .source // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/get-deployment.md b/docs/examples/1.7.x/server-swift/examples/functions/get-deployment.md new file mode 100644 index 0000000000..56ed2e8512 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/get-deployment.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let deployment = try await functions.getDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/get-execution.md b/docs/examples/1.7.x/server-swift/examples/functions/get-execution.md new file mode 100644 index 0000000000..6d24ee9390 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/get-execution.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let functions = Functions(client) + +let execution = try await functions.getExecution( + functionId: "<FUNCTION_ID>", + executionId: "<EXECUTION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/get-variable.md b/docs/examples/1.7.x/server-swift/examples/functions/get-variable.md new file mode 100644 index 0000000000..da20d68007 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/get-variable.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let variable = try await functions.getVariable( + functionId: "<FUNCTION_ID>", + variableId: "<VARIABLE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/get.md b/docs/examples/1.7.x/server-swift/examples/functions/get.md new file mode 100644 index 0000000000..98babdb04d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/get.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let function = try await functions.get( + functionId: "<FUNCTION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/list-deployments.md b/docs/examples/1.7.x/server-swift/examples/functions/list-deployments.md new file mode 100644 index 0000000000..599f301ca8 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/list-deployments.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let deploymentList = try await functions.listDeployments( + functionId: "<FUNCTION_ID>", + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/list-executions.md b/docs/examples/1.7.x/server-swift/examples/functions/list-executions.md new file mode 100644 index 0000000000..f0aa857f01 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/list-executions.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let functions = Functions(client) + +let executionList = try await functions.listExecutions( + functionId: "<FUNCTION_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/list-runtimes.md b/docs/examples/1.7.x/server-swift/examples/functions/list-runtimes.md new file mode 100644 index 0000000000..c4a3f31174 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/list-runtimes.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let runtimeList = try await functions.listRuntimes() + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/list-specifications.md b/docs/examples/1.7.x/server-swift/examples/functions/list-specifications.md new file mode 100644 index 0000000000..1f5914ba91 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/list-specifications.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let specificationList = try await functions.listSpecifications() + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/list-variables.md b/docs/examples/1.7.x/server-swift/examples/functions/list-variables.md new file mode 100644 index 0000000000..0343e54772 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/list-variables.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let variableList = try await functions.listVariables( + functionId: "<FUNCTION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/list.md b/docs/examples/1.7.x/server-swift/examples/functions/list.md new file mode 100644 index 0000000000..370b6bddfd --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/list.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let functionList = try await functions.list( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/update-deployment-status.md b/docs/examples/1.7.x/server-swift/examples/functions/update-deployment-status.md new file mode 100644 index 0000000000..1883199655 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/update-deployment-status.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let deployment = try await functions.updateDeploymentStatus( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/update-function-deployment.md b/docs/examples/1.7.x/server-swift/examples/functions/update-function-deployment.md new file mode 100644 index 0000000000..5557d82f10 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/update-function-deployment.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let function = try await functions.updateFunctionDeployment( + functionId: "<FUNCTION_ID>", + deploymentId: "<DEPLOYMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/update-variable.md b/docs/examples/1.7.x/server-swift/examples/functions/update-variable.md new file mode 100644 index 0000000000..974b2ed0ff --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/update-variable.md @@ -0,0 +1,17 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let variable = try await functions.updateVariable( + functionId: "<FUNCTION_ID>", + variableId: "<VARIABLE_ID>", + key: "<KEY>", + value: "<VALUE>", // optional + secret: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/functions/update.md b/docs/examples/1.7.x/server-swift/examples/functions/update.md new file mode 100644 index 0000000000..ebb2828bc8 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/functions/update.md @@ -0,0 +1,31 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let functions = Functions(client) + +let function = try await functions.update( + functionId: "<FUNCTION_ID>", + name: "<NAME>", + runtime: .node145, // optional + execute: ["any"], // optional + events: [], // optional + schedule: "", // optional + timeout: 1, // optional + enabled: false, // optional + logging: false, // optional + entrypoint: "<ENTRYPOINT>", // optional + commands: "<COMMANDS>", // optional + scopes: [], // optional + installationId: "<INSTALLATION_ID>", // optional + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch: "<PROVIDER_BRANCH>", // optional + providerSilentMode: false, // optional + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", // optional + specification: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/graphql/mutation.md b/docs/examples/1.7.x/server-swift/examples/graphql/mutation.md new file mode 100644 index 0000000000..ad33858894 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/graphql/mutation.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let graphql = Graphql(client) + +let any = try await graphql.mutation( + query: [:] +) + diff --git a/docs/examples/1.7.x/server-swift/examples/graphql/query.md b/docs/examples/1.7.x/server-swift/examples/graphql/query.md new file mode 100644 index 0000000000..f087c888a3 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/graphql/query.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let graphql = Graphql(client) + +let any = try await graphql.query( + query: [:] +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-antivirus.md b/docs/examples/1.7.x/server-swift/examples/health/get-antivirus.md new file mode 100644 index 0000000000..5fc335f8fc --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-antivirus.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthAntivirus = try await health.getAntivirus() + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-cache.md b/docs/examples/1.7.x/server-swift/examples/health/get-cache.md new file mode 100644 index 0000000000..a1c514b60e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-cache.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthStatus = try await health.getCache() + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-certificate.md b/docs/examples/1.7.x/server-swift/examples/health/get-certificate.md new file mode 100644 index 0000000000..6adf4d6052 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-certificate.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthCertificate = try await health.getCertificate( + domain: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-d-b.md b/docs/examples/1.7.x/server-swift/examples/health/get-d-b.md new file mode 100644 index 0000000000..a6aeb12e44 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-d-b.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthStatus = try await health.getDB() + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-failed-jobs.md b/docs/examples/1.7.x/server-swift/examples/health/get-failed-jobs.md new file mode 100644 index 0000000000..c508106bfa --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-failed-jobs.md @@ -0,0 +1,15 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getFailedJobs( + name: .v1Database, + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-pub-sub.md b/docs/examples/1.7.x/server-swift/examples/health/get-pub-sub.md new file mode 100644 index 0000000000..9a7766c94a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-pub-sub.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthStatus = try await health.getPubSub() + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-builds.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-builds.md new file mode 100644 index 0000000000..8db346ccbe --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-builds.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueBuilds( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-certificates.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..4814f29d87 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-certificates.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueCertificates( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-databases.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-databases.md new file mode 100644 index 0000000000..3acda3ddd7 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-databases.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueDatabases( + name: "<NAME>", // optional + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-deletes.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-deletes.md new file mode 100644 index 0000000000..8be397f53f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-deletes.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueDeletes( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-functions.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..aa420409d2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-functions.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueFunctions( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-logs.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..dc989a510f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-logs.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueLogs( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-mails.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-mails.md new file mode 100644 index 0000000000..2106b2f233 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-mails.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueMails( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-messaging.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-messaging.md new file mode 100644 index 0000000000..11cb16c5e3 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-messaging.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueMessaging( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-migrations.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-migrations.md new file mode 100644 index 0000000000..a0a4588b54 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-migrations.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueMigrations( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-stats-resources.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-stats-resources.md new file mode 100644 index 0000000000..4eb6ba7de3 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-stats-resources.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueStatsResources( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-usage.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..bfaeab0b36 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-usage.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueUsage( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-queue-webhooks.md b/docs/examples/1.7.x/server-swift/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..c315406627 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-queue-webhooks.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthQueue = try await health.getQueueWebhooks( + threshold: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-storage-local.md b/docs/examples/1.7.x/server-swift/examples/health/get-storage-local.md new file mode 100644 index 0000000000..9e23c09b6d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-storage-local.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthStatus = try await health.getStorageLocal() + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-storage.md b/docs/examples/1.7.x/server-swift/examples/health/get-storage.md new file mode 100644 index 0000000000..513ebac944 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-storage.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthStatus = try await health.getStorage() + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get-time.md b/docs/examples/1.7.x/server-swift/examples/health/get-time.md new file mode 100644 index 0000000000..6624b40b22 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get-time.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthTime = try await health.getTime() + diff --git a/docs/examples/1.7.x/server-swift/examples/health/get.md b/docs/examples/1.7.x/server-swift/examples/health/get.md new file mode 100644 index 0000000000..ef1ffaab6c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/health/get.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let health = Health(client) + +let healthStatus = try await health.get() + diff --git a/docs/examples/1.7.x/server-swift/examples/locale/get.md b/docs/examples/1.7.x/server-swift/examples/locale/get.md new file mode 100644 index 0000000000..e22f3157c7 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/locale/get.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let locale = Locale(client) + +let locale = try await locale.get() + diff --git a/docs/examples/1.7.x/server-swift/examples/locale/list-codes.md b/docs/examples/1.7.x/server-swift/examples/locale/list-codes.md new file mode 100644 index 0000000000..b31448a119 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/locale/list-codes.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let locale = Locale(client) + +let localeCodeList = try await locale.listCodes() + diff --git a/docs/examples/1.7.x/server-swift/examples/locale/list-continents.md b/docs/examples/1.7.x/server-swift/examples/locale/list-continents.md new file mode 100644 index 0000000000..c75abf8a4d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/locale/list-continents.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let locale = Locale(client) + +let continentList = try await locale.listContinents() + diff --git a/docs/examples/1.7.x/server-swift/examples/locale/list-countries-e-u.md b/docs/examples/1.7.x/server-swift/examples/locale/list-countries-e-u.md new file mode 100644 index 0000000000..e09f3db4f7 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/locale/list-countries-e-u.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let locale = Locale(client) + +let countryList = try await locale.listCountriesEU() + diff --git a/docs/examples/1.7.x/server-swift/examples/locale/list-countries-phones.md b/docs/examples/1.7.x/server-swift/examples/locale/list-countries-phones.md new file mode 100644 index 0000000000..de360c4408 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/locale/list-countries-phones.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let locale = Locale(client) + +let phoneList = try await locale.listCountriesPhones() + diff --git a/docs/examples/1.7.x/server-swift/examples/locale/list-countries.md b/docs/examples/1.7.x/server-swift/examples/locale/list-countries.md new file mode 100644 index 0000000000..b214f9899b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/locale/list-countries.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let locale = Locale(client) + +let countryList = try await locale.listCountries() + diff --git a/docs/examples/1.7.x/server-swift/examples/locale/list-currencies.md b/docs/examples/1.7.x/server-swift/examples/locale/list-currencies.md new file mode 100644 index 0000000000..a47cae696b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/locale/list-currencies.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let locale = Locale(client) + +let currencyList = try await locale.listCurrencies() + diff --git a/docs/examples/1.7.x/server-swift/examples/locale/list-languages.md b/docs/examples/1.7.x/server-swift/examples/locale/list-languages.md new file mode 100644 index 0000000000..40db7e5fe6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/locale/list-languages.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let locale = Locale(client) + +let languageList = try await locale.listLanguages() + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-apns-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-apns-provider.md new file mode 100644 index 0000000000..5e20018fef --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-apns-provider.md @@ -0,0 +1,20 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createApnsProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + authKey: "<AUTH_KEY>", // optional + authKeyId: "<AUTH_KEY_ID>", // optional + teamId: "<TEAM_ID>", // optional + bundleId: "<BUNDLE_ID>", // optional + sandbox: false, // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-email.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-email.md new file mode 100644 index 0000000000..a1b4774228 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-email.md @@ -0,0 +1,24 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let message = try await messaging.createEmail( + messageId: "<MESSAGE_ID>", + subject: "<SUBJECT>", + content: "<CONTENT>", + topics: [], // optional + users: [], // optional + targets: [], // optional + cc: [], // optional + bcc: [], // optional + attachments: [], // optional + draft: false, // optional + html: false, // optional + scheduledAt: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-fcm-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-fcm-provider.md new file mode 100644 index 0000000000..0071e477f1 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-fcm-provider.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createFcmProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + serviceAccountJSON: [:], // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-mailgun-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-mailgun-provider.md new file mode 100644 index 0000000000..aca295d1bd --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-mailgun-provider.md @@ -0,0 +1,22 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createMailgunProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + apiKey: "<API_KEY>", // optional + domain: "<DOMAIN>", // optional + isEuRegion: false, // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "email@example.com", // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-msg91provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-msg91provider.md new file mode 100644 index 0000000000..01503c10cb --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-msg91provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createMsg91Provider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + templateId: "<TEMPLATE_ID>", // optional + senderId: "<SENDER_ID>", // optional + authKey: "<AUTH_KEY>", // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-push.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-push.md new file mode 100644 index 0000000000..498eccb51a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-push.md @@ -0,0 +1,32 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let message = try await messaging.createPush( + messageId: "<MESSAGE_ID>", + title: "<TITLE>", // optional + body: "<BODY>", // optional + topics: [], // optional + users: [], // optional + targets: [], // optional + data: [:], // optional + action: "<ACTION>", // optional + image: "[ID1:ID2]", // optional + icon: "<ICON>", // optional + sound: "<SOUND>", // optional + color: "<COLOR>", // optional + tag: "<TAG>", // optional + badge: 0, // optional + draft: false, // optional + scheduledAt: "", // optional + contentAvailable: false, // optional + critical: false, // optional + priority: .normal // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-sendgrid-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-sendgrid-provider.md new file mode 100644 index 0000000000..5275f6cdb7 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-sendgrid-provider.md @@ -0,0 +1,20 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createSendgridProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + apiKey: "<API_KEY>", // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "email@example.com", // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-sms.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-sms.md new file mode 100644 index 0000000000..4f579312a9 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-sms.md @@ -0,0 +1,19 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let message = try await messaging.createSms( + messageId: "<MESSAGE_ID>", + content: "<CONTENT>", + topics: [], // optional + users: [], // optional + targets: [], // optional + draft: false, // optional + scheduledAt: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-smtp-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-smtp-provider.md new file mode 100644 index 0000000000..18d25df738 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-smtp-provider.md @@ -0,0 +1,27 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createSmtpProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + host: "<HOST>", + port: 1, // optional + username: "<USERNAME>", // optional + password: "<PASSWORD>", // optional + encryption: .none, // optional + autoTLS: false, // optional + mailer: "<MAILER>", // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "email@example.com", // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-subscriber.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-subscriber.md new file mode 100644 index 0000000000..cb23162484 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-subscriber.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setJWT("<YOUR_JWT>") // Your secret JSON Web Token + +let messaging = Messaging(client) + +let subscriber = try await messaging.createSubscriber( + topicId: "<TOPIC_ID>", + subscriberId: "<SUBSCRIBER_ID>", + targetId: "<TARGET_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-telesign-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-telesign-provider.md new file mode 100644 index 0000000000..a787134992 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-telesign-provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createTelesignProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", // optional + customerId: "<CUSTOMER_ID>", // optional + apiKey: "<API_KEY>", // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-textmagic-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-textmagic-provider.md new file mode 100644 index 0000000000..9b12a7d8cb --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-textmagic-provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createTextmagicProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", // optional + username: "<USERNAME>", // optional + apiKey: "<API_KEY>", // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-topic.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-topic.md new file mode 100644 index 0000000000..9429c45554 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-topic.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let topic = try await messaging.createTopic( + topicId: "<TOPIC_ID>", + name: "<NAME>", + subscribe: ["any"] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-twilio-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-twilio-provider.md new file mode 100644 index 0000000000..7421290e05 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-twilio-provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createTwilioProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", // optional + accountSid: "<ACCOUNT_SID>", // optional + authToken: "<AUTH_TOKEN>", // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/create-vonage-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/create-vonage-provider.md new file mode 100644 index 0000000000..b6a3014391 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/create-vonage-provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.createVonageProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", + from: "+12065550100", // optional + apiKey: "<API_KEY>", // optional + apiSecret: "<API_SECRET>", // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/delete-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/delete-provider.md new file mode 100644 index 0000000000..94da565e1f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/delete-provider.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let result = try await messaging.deleteProvider( + providerId: "<PROVIDER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/delete-subscriber.md b/docs/examples/1.7.x/server-swift/examples/messaging/delete-subscriber.md new file mode 100644 index 0000000000..b0aa96602f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/delete-subscriber.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setJWT("<YOUR_JWT>") // Your secret JSON Web Token + +let messaging = Messaging(client) + +let result = try await messaging.deleteSubscriber( + topicId: "<TOPIC_ID>", + subscriberId: "<SUBSCRIBER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/delete-topic.md b/docs/examples/1.7.x/server-swift/examples/messaging/delete-topic.md new file mode 100644 index 0000000000..6676adf94e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/delete-topic.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let result = try await messaging.deleteTopic( + topicId: "<TOPIC_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/delete.md b/docs/examples/1.7.x/server-swift/examples/messaging/delete.md new file mode 100644 index 0000000000..fca66c7f43 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/delete.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let result = try await messaging.delete( + messageId: "<MESSAGE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/get-message.md b/docs/examples/1.7.x/server-swift/examples/messaging/get-message.md new file mode 100644 index 0000000000..b1bbf9d5f0 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/get-message.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let message = try await messaging.getMessage( + messageId: "<MESSAGE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/get-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/get-provider.md new file mode 100644 index 0000000000..6ff8545bd0 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/get-provider.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.getProvider( + providerId: "<PROVIDER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/get-subscriber.md b/docs/examples/1.7.x/server-swift/examples/messaging/get-subscriber.md new file mode 100644 index 0000000000..55538e073d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/get-subscriber.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let subscriber = try await messaging.getSubscriber( + topicId: "<TOPIC_ID>", + subscriberId: "<SUBSCRIBER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/get-topic.md b/docs/examples/1.7.x/server-swift/examples/messaging/get-topic.md new file mode 100644 index 0000000000..0d2035bd9d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/get-topic.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let topic = try await messaging.getTopic( + topicId: "<TOPIC_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/list-message-logs.md b/docs/examples/1.7.x/server-swift/examples/messaging/list-message-logs.md new file mode 100644 index 0000000000..b7efe6fa9f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/list-message-logs.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let logList = try await messaging.listMessageLogs( + messageId: "<MESSAGE_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/list-messages.md b/docs/examples/1.7.x/server-swift/examples/messaging/list-messages.md new file mode 100644 index 0000000000..73832f7dae --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/list-messages.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let messageList = try await messaging.listMessages( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/list-provider-logs.md b/docs/examples/1.7.x/server-swift/examples/messaging/list-provider-logs.md new file mode 100644 index 0000000000..0633e15b62 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/list-provider-logs.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let logList = try await messaging.listProviderLogs( + providerId: "<PROVIDER_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/list-providers.md b/docs/examples/1.7.x/server-swift/examples/messaging/list-providers.md new file mode 100644 index 0000000000..c24af425a6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/list-providers.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let providerList = try await messaging.listProviders( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/list-subscriber-logs.md b/docs/examples/1.7.x/server-swift/examples/messaging/list-subscriber-logs.md new file mode 100644 index 0000000000..eab170d7cb --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/list-subscriber-logs.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let logList = try await messaging.listSubscriberLogs( + subscriberId: "<SUBSCRIBER_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/list-subscribers.md b/docs/examples/1.7.x/server-swift/examples/messaging/list-subscribers.md new file mode 100644 index 0000000000..a29bcefaf1 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/list-subscribers.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let subscriberList = try await messaging.listSubscribers( + topicId: "<TOPIC_ID>", + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/list-targets.md b/docs/examples/1.7.x/server-swift/examples/messaging/list-targets.md new file mode 100644 index 0000000000..974ae4f7b5 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/list-targets.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let targetList = try await messaging.listTargets( + messageId: "<MESSAGE_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/list-topic-logs.md b/docs/examples/1.7.x/server-swift/examples/messaging/list-topic-logs.md new file mode 100644 index 0000000000..e6f32ad232 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/list-topic-logs.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let logList = try await messaging.listTopicLogs( + topicId: "<TOPIC_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/list-topics.md b/docs/examples/1.7.x/server-swift/examples/messaging/list-topics.md new file mode 100644 index 0000000000..13106e940c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/list-topics.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let topicList = try await messaging.listTopics( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-apns-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-apns-provider.md new file mode 100644 index 0000000000..03afe5555b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-apns-provider.md @@ -0,0 +1,20 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateApnsProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + authKey: "<AUTH_KEY>", // optional + authKeyId: "<AUTH_KEY_ID>", // optional + teamId: "<TEAM_ID>", // optional + bundleId: "<BUNDLE_ID>", // optional + sandbox: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-email.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-email.md new file mode 100644 index 0000000000..1404fb8f77 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-email.md @@ -0,0 +1,24 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let message = try await messaging.updateEmail( + messageId: "<MESSAGE_ID>", + topics: [], // optional + users: [], // optional + targets: [], // optional + subject: "<SUBJECT>", // optional + content: "<CONTENT>", // optional + draft: false, // optional + html: false, // optional + cc: [], // optional + bcc: [], // optional + scheduledAt: "", // optional + attachments: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-fcm-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-fcm-provider.md new file mode 100644 index 0000000000..c4548f6549 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-fcm-provider.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateFcmProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + serviceAccountJSON: [:] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-mailgun-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-mailgun-provider.md new file mode 100644 index 0000000000..8ed28aa40e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-mailgun-provider.md @@ -0,0 +1,22 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateMailgunProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + apiKey: "<API_KEY>", // optional + domain: "<DOMAIN>", // optional + isEuRegion: false, // optional + enabled: false, // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "<REPLY_TO_EMAIL>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-msg91provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-msg91provider.md new file mode 100644 index 0000000000..e4a441c561 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-msg91provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateMsg91Provider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + templateId: "<TEMPLATE_ID>", // optional + senderId: "<SENDER_ID>", // optional + authKey: "<AUTH_KEY>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-push.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-push.md new file mode 100644 index 0000000000..e443161aa9 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-push.md @@ -0,0 +1,32 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let message = try await messaging.updatePush( + messageId: "<MESSAGE_ID>", + topics: [], // optional + users: [], // optional + targets: [], // optional + title: "<TITLE>", // optional + body: "<BODY>", // optional + data: [:], // optional + action: "<ACTION>", // optional + image: "[ID1:ID2]", // optional + icon: "<ICON>", // optional + sound: "<SOUND>", // optional + color: "<COLOR>", // optional + tag: "<TAG>", // optional + badge: 0, // optional + draft: false, // optional + scheduledAt: "", // optional + contentAvailable: false, // optional + critical: false, // optional + priority: .normal // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-sendgrid-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-sendgrid-provider.md new file mode 100644 index 0000000000..d363342af8 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-sendgrid-provider.md @@ -0,0 +1,20 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateSendgridProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + apiKey: "<API_KEY>", // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "<REPLY_TO_EMAIL>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-sms.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-sms.md new file mode 100644 index 0000000000..46b225fce0 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-sms.md @@ -0,0 +1,19 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let message = try await messaging.updateSms( + messageId: "<MESSAGE_ID>", + topics: [], // optional + users: [], // optional + targets: [], // optional + content: "<CONTENT>", // optional + draft: false, // optional + scheduledAt: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-smtp-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-smtp-provider.md new file mode 100644 index 0000000000..7ef8f2e760 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-smtp-provider.md @@ -0,0 +1,27 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateSmtpProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + host: "<HOST>", // optional + port: 1, // optional + username: "<USERNAME>", // optional + password: "<PASSWORD>", // optional + encryption: .none, // optional + autoTLS: false, // optional + mailer: "<MAILER>", // optional + fromName: "<FROM_NAME>", // optional + fromEmail: "email@example.com", // optional + replyToName: "<REPLY_TO_NAME>", // optional + replyToEmail: "<REPLY_TO_EMAIL>", // optional + enabled: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-telesign-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-telesign-provider.md new file mode 100644 index 0000000000..4475128b71 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-telesign-provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateTelesignProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + customerId: "<CUSTOMER_ID>", // optional + apiKey: "<API_KEY>", // optional + from: "<FROM>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-textmagic-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-textmagic-provider.md new file mode 100644 index 0000000000..e412faab65 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-textmagic-provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateTextmagicProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + username: "<USERNAME>", // optional + apiKey: "<API_KEY>", // optional + from: "<FROM>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-topic.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-topic.md new file mode 100644 index 0000000000..796f581f07 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-topic.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let topic = try await messaging.updateTopic( + topicId: "<TOPIC_ID>", + name: "<NAME>", // optional + subscribe: ["any"] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-twilio-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-twilio-provider.md new file mode 100644 index 0000000000..7b4592b048 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-twilio-provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateTwilioProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + accountSid: "<ACCOUNT_SID>", // optional + authToken: "<AUTH_TOKEN>", // optional + from: "<FROM>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/messaging/update-vonage-provider.md b/docs/examples/1.7.x/server-swift/examples/messaging/update-vonage-provider.md new file mode 100644 index 0000000000..ba10ce2309 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/messaging/update-vonage-provider.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let messaging = Messaging(client) + +let provider = try await messaging.updateVonageProvider( + providerId: "<PROVIDER_ID>", + name: "<NAME>", // optional + enabled: false, // optional + apiKey: "<API_KEY>", // optional + apiSecret: "<API_SECRET>", // optional + from: "<FROM>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/create-deployment.md b/docs/examples/1.7.x/server-swift/examples/sites/create-deployment.md new file mode 100644 index 0000000000..5730e8ef5c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/create-deployment.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let deployment = try await sites.createDeployment( + siteId: "<SITE_ID>", + code: InputFile.fromPath("file.png"), + activate: false, + installCommand: "<INSTALL_COMMAND>", // optional + buildCommand: "<BUILD_COMMAND>", // optional + outputDirectory: "<OUTPUT_DIRECTORY>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/create-duplicate-deployment.md b/docs/examples/1.7.x/server-swift/examples/sites/create-duplicate-deployment.md new file mode 100644 index 0000000000..0ec3804d7a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/create-duplicate-deployment.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let deployment = try await sites.createDuplicateDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/create-template-deployment.md b/docs/examples/1.7.x/server-swift/examples/sites/create-template-deployment.md new file mode 100644 index 0000000000..1cb3e42030 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/create-template-deployment.md @@ -0,0 +1,18 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let deployment = try await sites.createTemplateDeployment( + siteId: "<SITE_ID>", + repository: "<REPOSITORY>", + owner: "<OWNER>", + rootDirectory: "<ROOT_DIRECTORY>", + version: "<VERSION>", + activate: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/create-variable.md b/docs/examples/1.7.x/server-swift/examples/sites/create-variable.md new file mode 100644 index 0000000000..305a683fcd --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/create-variable.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let variable = try await sites.createVariable( + siteId: "<SITE_ID>", + key: "<KEY>", + value: "<VALUE>", + secret: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/create-vcs-deployment.md b/docs/examples/1.7.x/server-swift/examples/sites/create-vcs-deployment.md new file mode 100644 index 0000000000..d72540e715 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/create-vcs-deployment.md @@ -0,0 +1,17 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let deployment = try await sites.createVcsDeployment( + siteId: "<SITE_ID>", + type: .branch, + reference: "<REFERENCE>", + activate: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/create.md b/docs/examples/1.7.x/server-swift/examples/sites/create.md new file mode 100644 index 0000000000..1f961d0535 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/create.md @@ -0,0 +1,31 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let site = try await sites.create( + siteId: "<SITE_ID>", + name: "<NAME>", + framework: .analog, + buildRuntime: .node145, + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: "<INSTALL_COMMAND>", // optional + buildCommand: "<BUILD_COMMAND>", // optional + outputDirectory: "<OUTPUT_DIRECTORY>", // optional + adapter: .static, // optional + installationId: "<INSTALLATION_ID>", // optional + fallbackFile: "<FALLBACK_FILE>", // optional + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch: "<PROVIDER_BRANCH>", // optional + providerSilentMode: false, // optional + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", // optional + specification: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/delete-deployment.md b/docs/examples/1.7.x/server-swift/examples/sites/delete-deployment.md new file mode 100644 index 0000000000..c4f6971d7f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/delete-deployment.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let result = try await sites.deleteDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/delete-log.md b/docs/examples/1.7.x/server-swift/examples/sites/delete-log.md new file mode 100644 index 0000000000..1066551495 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/delete-log.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let result = try await sites.deleteLog( + siteId: "<SITE_ID>", + logId: "<LOG_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/delete-variable.md b/docs/examples/1.7.x/server-swift/examples/sites/delete-variable.md new file mode 100644 index 0000000000..a33e1c549e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/delete-variable.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let result = try await sites.deleteVariable( + siteId: "<SITE_ID>", + variableId: "<VARIABLE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/delete.md b/docs/examples/1.7.x/server-swift/examples/sites/delete.md new file mode 100644 index 0000000000..8283f70de2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/delete.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let result = try await sites.delete( + siteId: "<SITE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/get-deployment-download.md b/docs/examples/1.7.x/server-swift/examples/sites/get-deployment-download.md new file mode 100644 index 0000000000..5ed409c53b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/get-deployment-download.md @@ -0,0 +1,16 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let bytes = try await sites.getDeploymentDownload( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>", + type: .source // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/get-deployment.md b/docs/examples/1.7.x/server-swift/examples/sites/get-deployment.md new file mode 100644 index 0000000000..b9f04f3dfc --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/get-deployment.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let deployment = try await sites.getDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/get-log.md b/docs/examples/1.7.x/server-swift/examples/sites/get-log.md new file mode 100644 index 0000000000..1e5c8121a6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/get-log.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let execution = try await sites.getLog( + siteId: "<SITE_ID>", + logId: "<LOG_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/get-variable.md b/docs/examples/1.7.x/server-swift/examples/sites/get-variable.md new file mode 100644 index 0000000000..f9258fd5f6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/get-variable.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let variable = try await sites.getVariable( + siteId: "<SITE_ID>", + variableId: "<VARIABLE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/get.md b/docs/examples/1.7.x/server-swift/examples/sites/get.md new file mode 100644 index 0000000000..a14a9b73e7 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/get.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let site = try await sites.get( + siteId: "<SITE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/list-deployments.md b/docs/examples/1.7.x/server-swift/examples/sites/list-deployments.md new file mode 100644 index 0000000000..5516b74224 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/list-deployments.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let deploymentList = try await sites.listDeployments( + siteId: "<SITE_ID>", + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/list-frameworks.md b/docs/examples/1.7.x/server-swift/examples/sites/list-frameworks.md new file mode 100644 index 0000000000..13fdf9bca2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/list-frameworks.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let frameworkList = try await sites.listFrameworks() + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/list-logs.md b/docs/examples/1.7.x/server-swift/examples/sites/list-logs.md new file mode 100644 index 0000000000..3eb2a8c096 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/list-logs.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let executionList = try await sites.listLogs( + siteId: "<SITE_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/list-specifications.md b/docs/examples/1.7.x/server-swift/examples/sites/list-specifications.md new file mode 100644 index 0000000000..302e9ea50e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/list-specifications.md @@ -0,0 +1,11 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let specificationList = try await sites.listSpecifications() + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/list-variables.md b/docs/examples/1.7.x/server-swift/examples/sites/list-variables.md new file mode 100644 index 0000000000..9818224988 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/list-variables.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let variableList = try await sites.listVariables( + siteId: "<SITE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/list.md b/docs/examples/1.7.x/server-swift/examples/sites/list.md new file mode 100644 index 0000000000..f330c721b9 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/list.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let siteList = try await sites.list( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/update-deployment-status.md b/docs/examples/1.7.x/server-swift/examples/sites/update-deployment-status.md new file mode 100644 index 0000000000..104058713d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/update-deployment-status.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let deployment = try await sites.updateDeploymentStatus( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/update-site-deployment.md b/docs/examples/1.7.x/server-swift/examples/sites/update-site-deployment.md new file mode 100644 index 0000000000..ce330e4985 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/update-site-deployment.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let site = try await sites.updateSiteDeployment( + siteId: "<SITE_ID>", + deploymentId: "<DEPLOYMENT_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/update-variable.md b/docs/examples/1.7.x/server-swift/examples/sites/update-variable.md new file mode 100644 index 0000000000..8385c20e90 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/update-variable.md @@ -0,0 +1,17 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let variable = try await sites.updateVariable( + siteId: "<SITE_ID>", + variableId: "<VARIABLE_ID>", + key: "<KEY>", + value: "<VALUE>", // optional + secret: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/sites/update.md b/docs/examples/1.7.x/server-swift/examples/sites/update.md new file mode 100644 index 0000000000..e7de2fbd17 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/sites/update.md @@ -0,0 +1,31 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let sites = Sites(client) + +let site = try await sites.update( + siteId: "<SITE_ID>", + name: "<NAME>", + framework: .analog, + enabled: false, // optional + logging: false, // optional + timeout: 1, // optional + installCommand: "<INSTALL_COMMAND>", // optional + buildCommand: "<BUILD_COMMAND>", // optional + outputDirectory: "<OUTPUT_DIRECTORY>", // optional + buildRuntime: .node145, // optional + adapter: .static, // optional + fallbackFile: "<FALLBACK_FILE>", // optional + installationId: "<INSTALLATION_ID>", // optional + providerRepositoryId: "<PROVIDER_REPOSITORY_ID>", // optional + providerBranch: "<PROVIDER_BRANCH>", // optional + providerSilentMode: false, // optional + providerRootDirectory: "<PROVIDER_ROOT_DIRECTORY>", // optional + specification: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/create-bucket.md b/docs/examples/1.7.x/server-swift/examples/storage/create-bucket.md new file mode 100644 index 0000000000..a664e14f5f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/create-bucket.md @@ -0,0 +1,23 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let storage = Storage(client) + +let bucket = try await storage.createBucket( + bucketId: "<BUCKET_ID>", + name: "<NAME>", + permissions: ["read("any")"], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: .none, // optional + encryption: false, // optional + antivirus: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/create-file.md b/docs/examples/1.7.x/server-swift/examples/storage/create-file.md new file mode 100644 index 0000000000..540c869fab --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/create-file.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let storage = Storage(client) + +let file = try await storage.createFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + file: InputFile.fromPath("file.png"), + permissions: ["read("any")"] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/delete-bucket.md b/docs/examples/1.7.x/server-swift/examples/storage/delete-bucket.md new file mode 100644 index 0000000000..2f4916dba2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/delete-bucket.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let storage = Storage(client) + +let result = try await storage.deleteBucket( + bucketId: "<BUCKET_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/delete-file.md b/docs/examples/1.7.x/server-swift/examples/storage/delete-file.md new file mode 100644 index 0000000000..7ac1b194e6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/delete-file.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let storage = Storage(client) + +let result = try await storage.deleteFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/get-bucket.md b/docs/examples/1.7.x/server-swift/examples/storage/get-bucket.md new file mode 100644 index 0000000000..296a27bf85 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/get-bucket.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let storage = Storage(client) + +let bucket = try await storage.getBucket( + bucketId: "<BUCKET_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/get-file-download.md b/docs/examples/1.7.x/server-swift/examples/storage/get-file-download.md new file mode 100644 index 0000000000..b362b08cda --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/get-file-download.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let storage = Storage(client) + +let bytes = try await storage.getFileDownload( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + token: "<TOKEN>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/get-file-preview.md b/docs/examples/1.7.x/server-swift/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..d8c2380b7d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/get-file-preview.md @@ -0,0 +1,27 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let storage = Storage(client) + +let bytes = try await storage.getFilePreview( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + width: 0, // optional + height: 0, // optional + gravity: .center, // optional + quality: -1, // optional + borderWidth: 0, // optional + borderColor: "", // optional + borderRadius: 0, // optional + opacity: 0, // optional + rotation: -360, // optional + background: "", // optional + output: .jpg, // optional + token: "<TOKEN>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/get-file-view.md b/docs/examples/1.7.x/server-swift/examples/storage/get-file-view.md new file mode 100644 index 0000000000..a3b94eec45 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/get-file-view.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let storage = Storage(client) + +let bytes = try await storage.getFileView( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + token: "<TOKEN>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/get-file.md b/docs/examples/1.7.x/server-swift/examples/storage/get-file.md new file mode 100644 index 0000000000..033a643a83 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/get-file.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let storage = Storage(client) + +let file = try await storage.getFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/list-buckets.md b/docs/examples/1.7.x/server-swift/examples/storage/list-buckets.md new file mode 100644 index 0000000000..957d266e9a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/list-buckets.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let storage = Storage(client) + +let bucketList = try await storage.listBuckets( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/list-files.md b/docs/examples/1.7.x/server-swift/examples/storage/list-files.md new file mode 100644 index 0000000000..103d3c328c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/list-files.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let storage = Storage(client) + +let fileList = try await storage.listFiles( + bucketId: "<BUCKET_ID>", + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/update-bucket.md b/docs/examples/1.7.x/server-swift/examples/storage/update-bucket.md new file mode 100644 index 0000000000..de3b5bf0e5 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/update-bucket.md @@ -0,0 +1,23 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let storage = Storage(client) + +let bucket = try await storage.updateBucket( + bucketId: "<BUCKET_ID>", + name: "<NAME>", + permissions: ["read("any")"], // optional + fileSecurity: false, // optional + enabled: false, // optional + maximumFileSize: 1, // optional + allowedFileExtensions: [], // optional + compression: .none, // optional + encryption: false, // optional + antivirus: false // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/storage/update-file.md b/docs/examples/1.7.x/server-swift/examples/storage/update-file.md new file mode 100644 index 0000000000..d4d7484bd3 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/storage/update-file.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let storage = Storage(client) + +let file = try await storage.updateFile( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + name: "<NAME>", // optional + permissions: ["read("any")"] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/create-membership.md b/docs/examples/1.7.x/server-swift/examples/teams/create-membership.md new file mode 100644 index 0000000000..9010372175 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/create-membership.md @@ -0,0 +1,19 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let membership = try await teams.createMembership( + teamId: "<TEAM_ID>", + roles: [], + email: "email@example.com", // optional + userId: "<USER_ID>", // optional + phone: "+12065550100", // optional + url: "https://example.com", // optional + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/create.md b/docs/examples/1.7.x/server-swift/examples/teams/create.md new file mode 100644 index 0000000000..71f3d70874 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/create.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let team = try await teams.create( + teamId: "<TEAM_ID>", + name: "<NAME>", + roles: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/delete-membership.md b/docs/examples/1.7.x/server-swift/examples/teams/delete-membership.md new file mode 100644 index 0000000000..dbdbc96ff9 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/delete-membership.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let result = try await teams.deleteMembership( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/delete.md b/docs/examples/1.7.x/server-swift/examples/teams/delete.md new file mode 100644 index 0000000000..ee9daaa55b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/delete.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let result = try await teams.delete( + teamId: "<TEAM_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/get-membership.md b/docs/examples/1.7.x/server-swift/examples/teams/get-membership.md new file mode 100644 index 0000000000..ab7b29eb3a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/get-membership.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let membership = try await teams.getMembership( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/get-prefs.md b/docs/examples/1.7.x/server-swift/examples/teams/get-prefs.md new file mode 100644 index 0000000000..ae3e9f2875 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/get-prefs.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let preferences = try await teams.getPrefs( + teamId: "<TEAM_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/get.md b/docs/examples/1.7.x/server-swift/examples/teams/get.md new file mode 100644 index 0000000000..cd4b75567a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/get.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let team = try await teams.get( + teamId: "<TEAM_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/list-memberships.md b/docs/examples/1.7.x/server-swift/examples/teams/list-memberships.md new file mode 100644 index 0000000000..0670d91ab2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/list-memberships.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let membershipList = try await teams.listMemberships( + teamId: "<TEAM_ID>", + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/list.md b/docs/examples/1.7.x/server-swift/examples/teams/list.md new file mode 100644 index 0000000000..b5130cbf89 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/list.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let teamList = try await teams.list( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/update-membership-status.md b/docs/examples/1.7.x/server-swift/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..69fca1de74 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/update-membership-status.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let membership = try await teams.updateMembershipStatus( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>", + userId: "<USER_ID>", + secret: "<SECRET>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/update-membership.md b/docs/examples/1.7.x/server-swift/examples/teams/update-membership.md new file mode 100644 index 0000000000..47f28e74fd --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/update-membership.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let membership = try await teams.updateMembership( + teamId: "<TEAM_ID>", + membershipId: "<MEMBERSHIP_ID>", + roles: [] +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/update-name.md b/docs/examples/1.7.x/server-swift/examples/teams/update-name.md new file mode 100644 index 0000000000..56f5ab60db --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/update-name.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let team = try await teams.updateName( + teamId: "<TEAM_ID>", + name: "<NAME>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/teams/update-prefs.md b/docs/examples/1.7.x/server-swift/examples/teams/update-prefs.md new file mode 100644 index 0000000000..b8bb200b65 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/teams/update-prefs.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setSession("") // The user session to authenticate with + +let teams = Teams(client) + +let preferences = try await teams.updatePrefs( + teamId: "<TEAM_ID>", + prefs: [:] +) + diff --git a/docs/examples/1.7.x/server-swift/examples/tokens/create-file-token.md b/docs/examples/1.7.x/server-swift/examples/tokens/create-file-token.md new file mode 100644 index 0000000000..2bdc123b61 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/tokens/create-file-token.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let tokens = Tokens(client) + +let resourceToken = try await tokens.createFileToken( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + expire: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/tokens/delete.md b/docs/examples/1.7.x/server-swift/examples/tokens/delete.md new file mode 100644 index 0000000000..8b4db1435d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/tokens/delete.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let tokens = Tokens(client) + +let result = try await tokens.delete( + tokenId: "<TOKEN_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/tokens/get.md b/docs/examples/1.7.x/server-swift/examples/tokens/get.md new file mode 100644 index 0000000000..d6eac81059 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/tokens/get.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let tokens = Tokens(client) + +let resourceToken = try await tokens.get( + tokenId: "<TOKEN_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/tokens/list.md b/docs/examples/1.7.x/server-swift/examples/tokens/list.md new file mode 100644 index 0000000000..8438050754 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/tokens/list.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let tokens = Tokens(client) + +let resourceTokenList = try await tokens.list( + bucketId: "<BUCKET_ID>", + fileId: "<FILE_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/tokens/update.md b/docs/examples/1.7.x/server-swift/examples/tokens/update.md new file mode 100644 index 0000000000..14bcb30f78 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/tokens/update.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let tokens = Tokens(client) + +let resourceToken = try await tokens.update( + tokenId: "<TOKEN_ID>", + expire: "" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-argon2user.md b/docs/examples/1.7.x/server-swift/examples/users/create-argon2user.md new file mode 100644 index 0000000000..9b7477001d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-argon2user.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.createArgon2User( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-bcrypt-user.md b/docs/examples/1.7.x/server-swift/examples/users/create-bcrypt-user.md new file mode 100644 index 0000000000..ad5a81fe34 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-bcrypt-user.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.createBcryptUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-j-w-t.md b/docs/examples/1.7.x/server-swift/examples/users/create-j-w-t.md new file mode 100644 index 0000000000..d61adfb9a7 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-j-w-t.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let jwt = try await users.createJWT( + userId: "<USER_ID>", + sessionId: "<SESSION_ID>", // optional + duration: 0 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-m-d5user.md b/docs/examples/1.7.x/server-swift/examples/users/create-m-d5user.md new file mode 100644 index 0000000000..ffe7180c5e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-m-d5user.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.createMD5User( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-mfa-recovery-codes.md b/docs/examples/1.7.x/server-swift/examples/users/create-mfa-recovery-codes.md new file mode 100644 index 0000000000..577a533fcb --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let mfaRecoveryCodes = try await users.createMfaRecoveryCodes( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-p-h-pass-user.md b/docs/examples/1.7.x/server-swift/examples/users/create-p-h-pass-user.md new file mode 100644 index 0000000000..e1d8d3f3ef --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-p-h-pass-user.md @@ -0,0 +1,16 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.createPHPassUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-s-h-a-user.md b/docs/examples/1.7.x/server-swift/examples/users/create-s-h-a-user.md new file mode 100644 index 0000000000..ac42f2fe9d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-s-h-a-user.md @@ -0,0 +1,18 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.createSHAUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + passwordVersion: .sha1, // optional + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-scrypt-modified-user.md b/docs/examples/1.7.x/server-swift/examples/users/create-scrypt-modified-user.md new file mode 100644 index 0000000000..d6c67f6f3d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-scrypt-modified-user.md @@ -0,0 +1,19 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.createScryptModifiedUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + passwordSalt: "<PASSWORD_SALT>", + passwordSaltSeparator: "<PASSWORD_SALT_SEPARATOR>", + passwordSignerKey: "<PASSWORD_SIGNER_KEY>", + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-scrypt-user.md b/docs/examples/1.7.x/server-swift/examples/users/create-scrypt-user.md new file mode 100644 index 0000000000..16452c4606 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-scrypt-user.md @@ -0,0 +1,21 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.createScryptUser( + userId: "<USER_ID>", + email: "email@example.com", + password: "password", + passwordSalt: "<PASSWORD_SALT>", + passwordCpu: 0, + passwordMemory: 0, + passwordParallel: 0, + passwordLength: 0, + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-session.md b/docs/examples/1.7.x/server-swift/examples/users/create-session.md new file mode 100644 index 0000000000..cf6f67bd91 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-session.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let session = try await users.createSession( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-target.md b/docs/examples/1.7.x/server-swift/examples/users/create-target.md new file mode 100644 index 0000000000..e736afcf31 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-target.md @@ -0,0 +1,19 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let target = try await users.createTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>", + providerType: .email, + identifier: "<IDENTIFIER>", + providerId: "<PROVIDER_ID>", // optional + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create-token.md b/docs/examples/1.7.x/server-swift/examples/users/create-token.md new file mode 100644 index 0000000000..ca1767e178 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create-token.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let token = try await users.createToken( + userId: "<USER_ID>", + length: 4, // optional + expire: 60 // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/create.md b/docs/examples/1.7.x/server-swift/examples/users/create.md new file mode 100644 index 0000000000..98b886005b --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/create.md @@ -0,0 +1,17 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.create( + userId: "<USER_ID>", + email: "email@example.com", // optional + phone: "+12065550100", // optional + password: "", // optional + name: "<NAME>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/delete-identity.md b/docs/examples/1.7.x/server-swift/examples/users/delete-identity.md new file mode 100644 index 0000000000..bb3d812457 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/delete-identity.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let result = try await users.deleteIdentity( + identityId: "<IDENTITY_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/delete-mfa-authenticator.md b/docs/examples/1.7.x/server-swift/examples/users/delete-mfa-authenticator.md new file mode 100644 index 0000000000..da2b8e091a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/delete-mfa-authenticator.md @@ -0,0 +1,15 @@ +import Appwrite +import AppwriteEnums + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let result = try await users.deleteMfaAuthenticator( + userId: "<USER_ID>", + type: .totp +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/delete-session.md b/docs/examples/1.7.x/server-swift/examples/users/delete-session.md new file mode 100644 index 0000000000..c664e4f2ba --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/delete-session.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let result = try await users.deleteSession( + userId: "<USER_ID>", + sessionId: "<SESSION_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/delete-sessions.md b/docs/examples/1.7.x/server-swift/examples/users/delete-sessions.md new file mode 100644 index 0000000000..92ab9d7748 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/delete-sessions.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let result = try await users.deleteSessions( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/delete-target.md b/docs/examples/1.7.x/server-swift/examples/users/delete-target.md new file mode 100644 index 0000000000..1cce56657a --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/delete-target.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let result = try await users.deleteTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/delete.md b/docs/examples/1.7.x/server-swift/examples/users/delete.md new file mode 100644 index 0000000000..8dfe648d6e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/delete.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let result = try await users.delete( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/get-mfa-recovery-codes.md b/docs/examples/1.7.x/server-swift/examples/users/get-mfa-recovery-codes.md new file mode 100644 index 0000000000..1ae285142f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/get-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let mfaRecoveryCodes = try await users.getMfaRecoveryCodes( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/get-prefs.md b/docs/examples/1.7.x/server-swift/examples/users/get-prefs.md new file mode 100644 index 0000000000..c4ae61d9dd --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/get-prefs.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let preferences = try await users.getPrefs( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/get-target.md b/docs/examples/1.7.x/server-swift/examples/users/get-target.md new file mode 100644 index 0000000000..100c56398d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/get-target.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let target = try await users.getTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/get.md b/docs/examples/1.7.x/server-swift/examples/users/get.md new file mode 100644 index 0000000000..563042b8ef --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/get.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.get( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/list-identities.md b/docs/examples/1.7.x/server-swift/examples/users/list-identities.md new file mode 100644 index 0000000000..8cbe8a71f4 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/list-identities.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let identityList = try await users.listIdentities( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/list-logs.md b/docs/examples/1.7.x/server-swift/examples/users/list-logs.md new file mode 100644 index 0000000000..80d9199c3e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/list-logs.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let logList = try await users.listLogs( + userId: "<USER_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/list-memberships.md b/docs/examples/1.7.x/server-swift/examples/users/list-memberships.md new file mode 100644 index 0000000000..0ae34d4582 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/list-memberships.md @@ -0,0 +1,15 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let membershipList = try await users.listMemberships( + userId: "<USER_ID>", + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/list-mfa-factors.md b/docs/examples/1.7.x/server-swift/examples/users/list-mfa-factors.md new file mode 100644 index 0000000000..a5b5e38e12 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/list-mfa-factors.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let mfaFactors = try await users.listMfaFactors( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/list-sessions.md b/docs/examples/1.7.x/server-swift/examples/users/list-sessions.md new file mode 100644 index 0000000000..e0278279a4 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/list-sessions.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let sessionList = try await users.listSessions( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/list-targets.md b/docs/examples/1.7.x/server-swift/examples/users/list-targets.md new file mode 100644 index 0000000000..b069781f70 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/list-targets.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let targetList = try await users.listTargets( + userId: "<USER_ID>", + queries: [] // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/list.md b/docs/examples/1.7.x/server-swift/examples/users/list.md new file mode 100644 index 0000000000..45ccf23961 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/list.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let userList = try await users.list( + queries: [], // optional + search: "<SEARCH>" // optional +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-email-verification.md b/docs/examples/1.7.x/server-swift/examples/users/update-email-verification.md new file mode 100644 index 0000000000..e0de947fa2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-email-verification.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.updateEmailVerification( + userId: "<USER_ID>", + emailVerification: false +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-email.md b/docs/examples/1.7.x/server-swift/examples/users/update-email.md new file mode 100644 index 0000000000..4d3c1c2db2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-email.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.updateEmail( + userId: "<USER_ID>", + email: "email@example.com" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-labels.md b/docs/examples/1.7.x/server-swift/examples/users/update-labels.md new file mode 100644 index 0000000000..8916996b1f --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-labels.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.updateLabels( + userId: "<USER_ID>", + labels: [] +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-mfa-recovery-codes.md b/docs/examples/1.7.x/server-swift/examples/users/update-mfa-recovery-codes.md new file mode 100644 index 0000000000..a6169a782c --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-mfa-recovery-codes.md @@ -0,0 +1,13 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let mfaRecoveryCodes = try await users.updateMfaRecoveryCodes( + userId: "<USER_ID>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-mfa.md b/docs/examples/1.7.x/server-swift/examples/users/update-mfa.md new file mode 100644 index 0000000000..ad010f36b8 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-mfa.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.updateMfa( + userId: "<USER_ID>", + mfa: false +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-name.md b/docs/examples/1.7.x/server-swift/examples/users/update-name.md new file mode 100644 index 0000000000..3735b706d8 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-name.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.updateName( + userId: "<USER_ID>", + name: "<NAME>" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-password.md b/docs/examples/1.7.x/server-swift/examples/users/update-password.md new file mode 100644 index 0000000000..3a5b804478 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-password.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.updatePassword( + userId: "<USER_ID>", + password: "" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-phone-verification.md b/docs/examples/1.7.x/server-swift/examples/users/update-phone-verification.md new file mode 100644 index 0000000000..fffd768f5d --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-phone-verification.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.updatePhoneVerification( + userId: "<USER_ID>", + phoneVerification: false +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-phone.md b/docs/examples/1.7.x/server-swift/examples/users/update-phone.md new file mode 100644 index 0000000000..8411ad22a2 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-phone.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.updatePhone( + userId: "<USER_ID>", + number: "+12065550100" +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-prefs.md b/docs/examples/1.7.x/server-swift/examples/users/update-prefs.md new file mode 100644 index 0000000000..c71b712df3 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-prefs.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let preferences = try await users.updatePrefs( + userId: "<USER_ID>", + prefs: [:] +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-status.md b/docs/examples/1.7.x/server-swift/examples/users/update-status.md new file mode 100644 index 0000000000..43ecea44f6 --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-status.md @@ -0,0 +1,14 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let user = try await users.updateStatus( + userId: "<USER_ID>", + status: false +) + diff --git a/docs/examples/1.7.x/server-swift/examples/users/update-target.md b/docs/examples/1.7.x/server-swift/examples/users/update-target.md new file mode 100644 index 0000000000..579f0d282e --- /dev/null +++ b/docs/examples/1.7.x/server-swift/examples/users/update-target.md @@ -0,0 +1,17 @@ +import Appwrite + +let client = Client() + .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .setProject("<YOUR_PROJECT_ID>") // Your project ID + .setKey("<YOUR_API_KEY>") // Your secret API key + +let users = Users(client) + +let target = try await users.updateTarget( + userId: "<USER_ID>", + targetId: "<TARGET_ID>", + identifier: "<IDENTIFIER>", // optional + providerId: "<PROVIDER_ID>", // optional + name: "<NAME>" // optional +) + diff --git a/docs/references/functions/create-build.md b/docs/references/functions/create-build.md index 7a8ac750e8..160a04c291 100644 --- a/docs/references/functions/create-build.md +++ b/docs/references/functions/create-build.md @@ -1 +1 @@ -Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. \ No newline at end of file +Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. \ No newline at end of file diff --git a/docs/references/functions/list-deployments.md b/docs/references/functions/list-deployments.md index 8b24f911f2..80bbba1bf6 100644 --- a/docs/references/functions/list-deployments.md +++ b/docs/references/functions/list-deployments.md @@ -1 +1 @@ -Get a list of all the project's code deployments. You can use the query params to filter your results. \ No newline at end of file +Get a list of all the function's code deployments. You can use the query params to filter your results. \ No newline at end of file diff --git a/docs/references/migrations/migration-csv.md b/docs/references/migrations/migration-csv.md new file mode 100644 index 0000000000..7a32d5ff6e --- /dev/null +++ b/docs/references/migrations/migration-csv.md @@ -0,0 +1 @@ +Import documents from a CSV file into your Appwrite database. This endpoint allows you to import documents from a CSV file uploaded to Appwrite Storage bucket. \ No newline at end of file diff --git a/docs/references/proxy/create-rule.md b/docs/references/proxy/create-rule.md deleted file mode 100644 index be567b1cc0..0000000000 --- a/docs/references/proxy/create-rule.md +++ /dev/null @@ -1 +0,0 @@ -Create a new proxy rule. \ No newline at end of file diff --git a/docs/sdks/android/CHANGELOG.md b/docs/sdks/android/CHANGELOG.md index fa4d35e687..8406e637b0 100644 --- a/docs/sdks/android/CHANGELOG.md +++ b/docs/sdks/android/CHANGELOG.md @@ -1 +1,8 @@ -# Change Log \ No newline at end of file +# Change Log + +## 8.0.0 + +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Update default `quality` for `getFilePreview` from 0 to -1 +* Remove `Gif` from ImageFormat enum +* Remove `search` param from `listExecutions` method \ No newline at end of file diff --git a/docs/sdks/apple/CHANGELOG.md b/docs/sdks/apple/CHANGELOG.md index fa4d35e687..bc30d56a4b 100644 --- a/docs/sdks/apple/CHANGELOG.md +++ b/docs/sdks/apple/CHANGELOG.md @@ -1 +1,8 @@ -# Change Log \ No newline at end of file +# Change Log + +## 10.0.0 + +* Add `<REGION>` to doc examples due to the new multi region endpoints +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Remove `search` param from `listExecutions` method +* Remove `Gif` from ImageFormat enum \ No newline at end of file diff --git a/docs/sdks/dart/CHANGELOG.md b/docs/sdks/dart/CHANGELOG.md index c41413b9ec..57a53e5f75 100644 --- a/docs/sdks/dart/CHANGELOG.md +++ b/docs/sdks/dart/CHANGELOG.md @@ -1,3 +1,17 @@ +# Change Log + +## 16.0.0 + +* Add `<REGION>` to doc examples due to the new multi region endpoints +* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. +* Add doc examples, class and methods for new `Sites` service +* Add doc examples, class and methods for new `Tokens` service +* Add enums for `BuildRuntime `, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Add `queries` and `search` params to `listMemberships` method +* Update enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 +* Remove `search` param from `listExecutions` method + ## 14.0.0 * Breaking changes: diff --git a/docs/sdks/deno/CHANGELOG.md b/docs/sdks/deno/CHANGELOG.md index fa4d35e687..e46648db82 100644 --- a/docs/sdks/deno/CHANGELOG.md +++ b/docs/sdks/deno/CHANGELOG.md @@ -1 +1,13 @@ -# Change Log \ No newline at end of file +# Change Log + +## 15.0.0 + +* Add `<REGION>` to doc examples due to the new multi region endpoints +* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. +* Add doc examples, class and methods for new `Sites` service +* Add doc examples, class and methods for new `Tokens` service +* Add enums for `BuildRuntime `, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` +* Updates enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Add `queries` and `search` params to `listMemberships` method +* Removes `search` param from `listExecutions` method \ No newline at end of file diff --git a/docs/sdks/flutter/CHANGELOG.md b/docs/sdks/flutter/CHANGELOG.md index 357b9ff065..674742b845 100644 --- a/docs/sdks/flutter/CHANGELOG.md +++ b/docs/sdks/flutter/CHANGELOG.md @@ -1,3 +1,12 @@ +# Change Log + +## 16.0.0 + +* Remove `Gif` from ImageFormat enum +* Remove `search` param from `listExecutions` method +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Update default `quality` for `getFilePreview` from 0 to -1 + ## 15.0.2 * Avoid setting empty `User-Agent` header and only encode it when present. diff --git a/docs/sdks/nodejs/CHANGELOG.md b/docs/sdks/nodejs/CHANGELOG.md index fa4d35e687..c8a8a16c8e 100644 --- a/docs/sdks/nodejs/CHANGELOG.md +++ b/docs/sdks/nodejs/CHANGELOG.md @@ -1 +1,13 @@ -# Change Log \ No newline at end of file +# Change Log + +## 17.0.0 + +* Add `<REGION>` to doc examples due to the new multi region endpoints +* Add doc examples and methods for bulk api transactions: `createDocuments`, `deleteDocuments` etc. +* Add doc examples, class and methods for new `Sites` service +* Add doc examples, class and methods for new `Tokens` service +* Add enums for `BuildRuntime `, `Adapter`, `Framework`, `DeploymentDownloadType` and `VCSDeploymentType` +* Updates enum for `runtimes` with Pythonml312, Dart219, Flutter327 and Flutter329 +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Add `queries` and `search` params to `listMemberships` method +* Removes `search` param from `listExecutions` method \ No newline at end of file diff --git a/docs/sdks/react-native/CHANGELOG.md b/docs/sdks/react-native/CHANGELOG.md index f720e11ac6..1bc7d89373 100644 --- a/docs/sdks/react-native/CHANGELOG.md +++ b/docs/sdks/react-native/CHANGELOG.md @@ -1,5 +1,12 @@ # Change log +## 0.9.0 + +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Update default `quality` for `getFilePreview` from 0 to -1 +* Remove `Gif` from ImageFormat enum +* Remove `search` param from `listExecutions` method + ## 0.7.4 * Upgrade dependencies to resolve PlatformConstants error with Expo 53 diff --git a/docs/sdks/web/CHANGELOG.md b/docs/sdks/web/CHANGELOG.md index fa4d35e687..5923160f8f 100644 --- a/docs/sdks/web/CHANGELOG.md +++ b/docs/sdks/web/CHANGELOG.md @@ -1 +1,9 @@ -# Change Log \ No newline at end of file +# Change Log + +## 18.0.0 + +* Add `<REGION>` to doc examples due to the new multi region endpoints +* Remove `Gif` from ImageFormat enum +* Remove `search` param from `listExecutions` method +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Improve CORS error catching in `client.call` method \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000000..b18f3d6d58 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,8 @@ +parameters: + level: 8 + paths: + - src/Appwrite/Transformation + scanDirectories: + - vendor/swoole/ide-helper + excludePaths: + - tests/resources \ No newline at end of file diff --git a/public/images/logos/appwrite-icon.png b/public/images/logos/appwrite-icon.png new file mode 100644 index 0000000000..5d993a6b33 Binary files /dev/null and b/public/images/logos/appwrite-icon.png differ diff --git a/public/images/logos/appwrite-icon.svg b/public/images/logos/appwrite-icon.svg new file mode 100644 index 0000000000..afbc1124c2 --- /dev/null +++ b/public/images/logos/appwrite-icon.svg @@ -0,0 +1,11 @@ +<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> + <g clip-path="url(#clip0_28_719)"> + <path d="M24.4429 17.4322V22.9096H10.7519C6.76318 22.9096 3.28044 20.7067 1.4171 17.4322C1.14622 16.9561 0.909137 16.4567 0.710264 15.9383C0.319864 14.9225 0.0744552 13.8325 0 12.6952V11.2143C0.0161646 10.9609 0.0416361 10.7094 0.0749451 10.4609C0.143032 9.95105 0.245898 9.45211 0.381093 8.96711C1.66006 4.36909 5.81877 1 10.7519 1C15.6851 1 19.8433 4.36909 21.1223 8.96711H15.2682C14.3072 7.4683 12.6437 6.4774 10.7519 6.4774C8.86017 6.4774 7.19668 7.4683 6.23562 8.96711C5.9427 9.42274 5.71542 9.92516 5.56651 10.4609C5.43425 10.936 5.36371 11.4369 5.36371 11.9548C5.36371 13.5248 6.01324 14.94 7.05463 15.9383C8.01961 16.865 9.32061 17.4322 10.7519 17.4322H24.4429Z" fill="#FD366E" /> + <path d="M24.4429 10.4609V15.9383H14.4492C15.4906 14.94 16.1401 13.5248 16.1401 11.9548C16.1401 11.4369 16.0696 10.936 15.9373 10.4609H24.4429Z" fill="#FD366E" /> + </g> + <defs> + <clipPath id="clip0_28_719"> + <rect width="24" height="24" fill="white" /> + </clipPath> + </defs> +</svg> \ No newline at end of file diff --git a/public/images/sites/templates/astro-nano-dark.png b/public/images/sites/templates/astro-nano-dark.png new file mode 100644 index 0000000000..dec79ae9b2 Binary files /dev/null and b/public/images/sites/templates/astro-nano-dark.png differ diff --git a/public/images/sites/templates/astro-nano-light.png b/public/images/sites/templates/astro-nano-light.png new file mode 100644 index 0000000000..3a846c94d9 Binary files /dev/null and b/public/images/sites/templates/astro-nano-light.png differ diff --git a/public/images/sites/templates/astro-sphere-dark.png b/public/images/sites/templates/astro-sphere-dark.png new file mode 100644 index 0000000000..ba12a3bcb7 Binary files /dev/null and b/public/images/sites/templates/astro-sphere-dark.png differ diff --git a/public/images/sites/templates/astro-sphere-light.png b/public/images/sites/templates/astro-sphere-light.png new file mode 100644 index 0000000000..0a24d533d8 Binary files /dev/null and b/public/images/sites/templates/astro-sphere-light.png differ diff --git a/public/images/sites/templates/astro-starlight-dark.png b/public/images/sites/templates/astro-starlight-dark.png new file mode 100644 index 0000000000..0c8f722e7e Binary files /dev/null and b/public/images/sites/templates/astro-starlight-dark.png differ diff --git a/public/images/sites/templates/astro-starlight-light.png b/public/images/sites/templates/astro-starlight-light.png new file mode 100644 index 0000000000..bade7a585a Binary files /dev/null and b/public/images/sites/templates/astro-starlight-light.png differ diff --git a/public/images/sites/templates/astro-starlog-dark.png b/public/images/sites/templates/astro-starlog-dark.png new file mode 100644 index 0000000000..00354471c3 Binary files /dev/null and b/public/images/sites/templates/astro-starlog-dark.png differ diff --git a/public/images/sites/templates/astro-starlog-light.png b/public/images/sites/templates/astro-starlog-light.png new file mode 100644 index 0000000000..4eb8cd7b19 Binary files /dev/null and b/public/images/sites/templates/astro-starlog-light.png differ diff --git a/public/images/sites/templates/docusaurus-dark.png b/public/images/sites/templates/docusaurus-dark.png new file mode 100644 index 0000000000..916ce071ec Binary files /dev/null and b/public/images/sites/templates/docusaurus-dark.png differ diff --git a/public/images/sites/templates/docusaurus-light.png b/public/images/sites/templates/docusaurus-light.png new file mode 100644 index 0000000000..916ce071ec Binary files /dev/null and b/public/images/sites/templates/docusaurus-light.png differ diff --git a/public/images/sites/templates/littlelink-dark.png b/public/images/sites/templates/littlelink-dark.png new file mode 100644 index 0000000000..fe94d21b53 Binary files /dev/null and b/public/images/sites/templates/littlelink-dark.png differ diff --git a/public/images/sites/templates/littlelink-light.png b/public/images/sites/templates/littlelink-light.png new file mode 100644 index 0000000000..79392906c3 Binary files /dev/null and b/public/images/sites/templates/littlelink-light.png differ diff --git a/public/images/sites/templates/logspot-dark.png b/public/images/sites/templates/logspot-dark.png new file mode 100644 index 0000000000..236ca177c6 Binary files /dev/null and b/public/images/sites/templates/logspot-dark.png differ diff --git a/public/images/sites/templates/logspot-light.png b/public/images/sites/templates/logspot-light.png new file mode 100644 index 0000000000..236ca177c6 Binary files /dev/null and b/public/images/sites/templates/logspot-light.png differ diff --git a/public/images/sites/templates/magic-portfolio-dark.png b/public/images/sites/templates/magic-portfolio-dark.png new file mode 100644 index 0000000000..5fbe91977d Binary files /dev/null and b/public/images/sites/templates/magic-portfolio-dark.png differ diff --git a/public/images/sites/templates/magic-portfolio-light.png b/public/images/sites/templates/magic-portfolio-light.png new file mode 100644 index 0000000000..233c3bb046 Binary files /dev/null and b/public/images/sites/templates/magic-portfolio-light.png differ diff --git a/public/images/sites/templates/nxt-lnk-dark.png b/public/images/sites/templates/nxt-lnk-dark.png new file mode 100644 index 0000000000..004a5a487e Binary files /dev/null and b/public/images/sites/templates/nxt-lnk-dark.png differ diff --git a/public/images/sites/templates/nxt-lnk-light.png b/public/images/sites/templates/nxt-lnk-light.png new file mode 100644 index 0000000000..43a93ed3f7 Binary files /dev/null and b/public/images/sites/templates/nxt-lnk-light.png differ diff --git a/public/images/sites/templates/onelink-dark.png b/public/images/sites/templates/onelink-dark.png new file mode 100644 index 0000000000..691214e861 Binary files /dev/null and b/public/images/sites/templates/onelink-dark.png differ diff --git a/public/images/sites/templates/onelink-light.png b/public/images/sites/templates/onelink-light.png new file mode 100644 index 0000000000..63f4a506f5 Binary files /dev/null and b/public/images/sites/templates/onelink-light.png differ diff --git a/public/images/sites/templates/playground-for-analog-dark.png b/public/images/sites/templates/playground-for-analog-dark.png new file mode 100644 index 0000000000..7a1d1d77ef Binary files /dev/null and b/public/images/sites/templates/playground-for-analog-dark.png differ diff --git a/public/images/sites/templates/playground-for-analog-light.png b/public/images/sites/templates/playground-for-analog-light.png new file mode 100644 index 0000000000..69d2efb753 Binary files /dev/null and b/public/images/sites/templates/playground-for-analog-light.png differ diff --git a/public/images/sites/templates/playground-for-angular-dark.png b/public/images/sites/templates/playground-for-angular-dark.png new file mode 100644 index 0000000000..91a77137d3 Binary files /dev/null and b/public/images/sites/templates/playground-for-angular-dark.png differ diff --git a/public/images/sites/templates/playground-for-angular-light.png b/public/images/sites/templates/playground-for-angular-light.png new file mode 100644 index 0000000000..91a77137d3 Binary files /dev/null and b/public/images/sites/templates/playground-for-angular-light.png differ diff --git a/public/images/sites/templates/playground-for-astro-dark.png b/public/images/sites/templates/playground-for-astro-dark.png new file mode 100644 index 0000000000..3d064c5cdd Binary files /dev/null and b/public/images/sites/templates/playground-for-astro-dark.png differ diff --git a/public/images/sites/templates/playground-for-astro-light.png b/public/images/sites/templates/playground-for-astro-light.png new file mode 100644 index 0000000000..3d064c5cdd Binary files /dev/null and b/public/images/sites/templates/playground-for-astro-light.png differ diff --git a/public/images/sites/templates/playground-for-flutter-dark.png b/public/images/sites/templates/playground-for-flutter-dark.png new file mode 100644 index 0000000000..9b239ff767 Binary files /dev/null and b/public/images/sites/templates/playground-for-flutter-dark.png differ diff --git a/public/images/sites/templates/playground-for-flutter-light.png b/public/images/sites/templates/playground-for-flutter-light.png new file mode 100644 index 0000000000..9b239ff767 Binary files /dev/null and b/public/images/sites/templates/playground-for-flutter-light.png differ diff --git a/public/images/sites/templates/playground-for-lynx-dark.png b/public/images/sites/templates/playground-for-lynx-dark.png new file mode 100644 index 0000000000..7697b3bea4 Binary files /dev/null and b/public/images/sites/templates/playground-for-lynx-dark.png differ diff --git a/public/images/sites/templates/playground-for-lynx-light.png b/public/images/sites/templates/playground-for-lynx-light.png new file mode 100644 index 0000000000..655d810d10 Binary files /dev/null and b/public/images/sites/templates/playground-for-lynx-light.png differ diff --git a/public/images/sites/templates/playground-for-nextjs-dark.png b/public/images/sites/templates/playground-for-nextjs-dark.png new file mode 100644 index 0000000000..9569a416de Binary files /dev/null and b/public/images/sites/templates/playground-for-nextjs-dark.png differ diff --git a/public/images/sites/templates/playground-for-nextjs-light.png b/public/images/sites/templates/playground-for-nextjs-light.png new file mode 100644 index 0000000000..d048c17a8a Binary files /dev/null and b/public/images/sites/templates/playground-for-nextjs-light.png differ diff --git a/public/images/sites/templates/playground-for-nuxt-dark.png b/public/images/sites/templates/playground-for-nuxt-dark.png new file mode 100644 index 0000000000..bea04f1cf9 Binary files /dev/null and b/public/images/sites/templates/playground-for-nuxt-dark.png differ diff --git a/public/images/sites/templates/playground-for-nuxt-light.png b/public/images/sites/templates/playground-for-nuxt-light.png new file mode 100644 index 0000000000..006e366a9f Binary files /dev/null and b/public/images/sites/templates/playground-for-nuxt-light.png differ diff --git a/public/images/sites/templates/playground-for-react-dark.png b/public/images/sites/templates/playground-for-react-dark.png new file mode 100644 index 0000000000..6873d5632e Binary files /dev/null and b/public/images/sites/templates/playground-for-react-dark.png differ diff --git a/public/images/sites/templates/playground-for-react-light.png b/public/images/sites/templates/playground-for-react-light.png new file mode 100644 index 0000000000..79dc16ffdb Binary files /dev/null and b/public/images/sites/templates/playground-for-react-light.png differ diff --git a/public/images/sites/templates/playground-for-react-native-dark.png b/public/images/sites/templates/playground-for-react-native-dark.png new file mode 100644 index 0000000000..0e20806edc Binary files /dev/null and b/public/images/sites/templates/playground-for-react-native-dark.png differ diff --git a/public/images/sites/templates/playground-for-react-native-light.png b/public/images/sites/templates/playground-for-react-native-light.png new file mode 100644 index 0000000000..12829d47d6 Binary files /dev/null and b/public/images/sites/templates/playground-for-react-native-light.png differ diff --git a/public/images/sites/templates/playground-for-remix-dark.png b/public/images/sites/templates/playground-for-remix-dark.png new file mode 100644 index 0000000000..092e96da32 Binary files /dev/null and b/public/images/sites/templates/playground-for-remix-dark.png differ diff --git a/public/images/sites/templates/playground-for-remix-light.png b/public/images/sites/templates/playground-for-remix-light.png new file mode 100644 index 0000000000..f2ef9a9baf Binary files /dev/null and b/public/images/sites/templates/playground-for-remix-light.png differ diff --git a/public/images/sites/templates/playground-for-svelte-dark.png b/public/images/sites/templates/playground-for-svelte-dark.png new file mode 100644 index 0000000000..90ac7f96aa Binary files /dev/null and b/public/images/sites/templates/playground-for-svelte-dark.png differ diff --git a/public/images/sites/templates/playground-for-svelte-light.png b/public/images/sites/templates/playground-for-svelte-light.png new file mode 100644 index 0000000000..90ac7f96aa Binary files /dev/null and b/public/images/sites/templates/playground-for-svelte-light.png differ diff --git a/public/images/sites/templates/playground-for-vite-dark.png b/public/images/sites/templates/playground-for-vite-dark.png new file mode 100644 index 0000000000..35dfb354d9 Binary files /dev/null and b/public/images/sites/templates/playground-for-vite-dark.png differ diff --git a/public/images/sites/templates/playground-for-vite-light.png b/public/images/sites/templates/playground-for-vite-light.png new file mode 100644 index 0000000000..f06fab0470 Binary files /dev/null and b/public/images/sites/templates/playground-for-vite-light.png differ diff --git a/public/images/sites/templates/playground-for-vue-dark.png b/public/images/sites/templates/playground-for-vue-dark.png new file mode 100644 index 0000000000..7df0dfd555 Binary files /dev/null and b/public/images/sites/templates/playground-for-vue-dark.png differ diff --git a/public/images/sites/templates/playground-for-vue-light.png b/public/images/sites/templates/playground-for-vue-light.png new file mode 100644 index 0000000000..850e7ba9b8 Binary files /dev/null and b/public/images/sites/templates/playground-for-vue-light.png differ diff --git a/public/images/sites/templates/starter-for-analog-dark.png b/public/images/sites/templates/starter-for-analog-dark.png new file mode 100644 index 0000000000..7529e08dd8 Binary files /dev/null and b/public/images/sites/templates/starter-for-analog-dark.png differ diff --git a/public/images/sites/templates/starter-for-analog-light.png b/public/images/sites/templates/starter-for-analog-light.png new file mode 100644 index 0000000000..7529e08dd8 Binary files /dev/null and b/public/images/sites/templates/starter-for-analog-light.png differ diff --git a/public/images/sites/templates/starter-for-angular-dark.png b/public/images/sites/templates/starter-for-angular-dark.png new file mode 100644 index 0000000000..a7ba12ee76 Binary files /dev/null and b/public/images/sites/templates/starter-for-angular-dark.png differ diff --git a/public/images/sites/templates/starter-for-angular-light.png b/public/images/sites/templates/starter-for-angular-light.png new file mode 100644 index 0000000000..a7ba12ee76 Binary files /dev/null and b/public/images/sites/templates/starter-for-angular-light.png differ diff --git a/public/images/sites/templates/starter-for-astro-dark.png b/public/images/sites/templates/starter-for-astro-dark.png new file mode 100644 index 0000000000..5380b32b7d Binary files /dev/null and b/public/images/sites/templates/starter-for-astro-dark.png differ diff --git a/public/images/sites/templates/starter-for-astro-light.png b/public/images/sites/templates/starter-for-astro-light.png new file mode 100644 index 0000000000..5380b32b7d Binary files /dev/null and b/public/images/sites/templates/starter-for-astro-light.png differ diff --git a/public/images/sites/templates/starter-for-flutter-dark.png b/public/images/sites/templates/starter-for-flutter-dark.png new file mode 100644 index 0000000000..760cd8d341 Binary files /dev/null and b/public/images/sites/templates/starter-for-flutter-dark.png differ diff --git a/public/images/sites/templates/starter-for-flutter-light.png b/public/images/sites/templates/starter-for-flutter-light.png new file mode 100644 index 0000000000..760cd8d341 Binary files /dev/null and b/public/images/sites/templates/starter-for-flutter-light.png differ diff --git a/public/images/sites/templates/starter-for-js-dark.png b/public/images/sites/templates/starter-for-js-dark.png new file mode 100644 index 0000000000..435b619f35 Binary files /dev/null and b/public/images/sites/templates/starter-for-js-dark.png differ diff --git a/public/images/sites/templates/starter-for-js-light.png b/public/images/sites/templates/starter-for-js-light.png new file mode 100644 index 0000000000..435b619f35 Binary files /dev/null and b/public/images/sites/templates/starter-for-js-light.png differ diff --git a/public/images/sites/templates/starter-for-nextjs-dark.png b/public/images/sites/templates/starter-for-nextjs-dark.png new file mode 100644 index 0000000000..7acc80d4d4 Binary files /dev/null and b/public/images/sites/templates/starter-for-nextjs-dark.png differ diff --git a/public/images/sites/templates/starter-for-nextjs-light.png b/public/images/sites/templates/starter-for-nextjs-light.png new file mode 100644 index 0000000000..7acc80d4d4 Binary files /dev/null and b/public/images/sites/templates/starter-for-nextjs-light.png differ diff --git a/public/images/sites/templates/starter-for-nuxt-dark.png b/public/images/sites/templates/starter-for-nuxt-dark.png new file mode 100644 index 0000000000..ab8884febd Binary files /dev/null and b/public/images/sites/templates/starter-for-nuxt-dark.png differ diff --git a/public/images/sites/templates/starter-for-nuxt-light.png b/public/images/sites/templates/starter-for-nuxt-light.png new file mode 100644 index 0000000000..ab8884febd Binary files /dev/null and b/public/images/sites/templates/starter-for-nuxt-light.png differ diff --git a/public/images/sites/templates/starter-for-react-dark.png b/public/images/sites/templates/starter-for-react-dark.png new file mode 100644 index 0000000000..dcfc0a5521 Binary files /dev/null and b/public/images/sites/templates/starter-for-react-dark.png differ diff --git a/public/images/sites/templates/starter-for-react-light.png b/public/images/sites/templates/starter-for-react-light.png new file mode 100644 index 0000000000..dcfc0a5521 Binary files /dev/null and b/public/images/sites/templates/starter-for-react-light.png differ diff --git a/public/images/sites/templates/starter-for-react-native-dark.png b/public/images/sites/templates/starter-for-react-native-dark.png new file mode 100644 index 0000000000..4bb4f80c02 Binary files /dev/null and b/public/images/sites/templates/starter-for-react-native-dark.png differ diff --git a/public/images/sites/templates/starter-for-react-native-light.png b/public/images/sites/templates/starter-for-react-native-light.png new file mode 100644 index 0000000000..4bb4f80c02 Binary files /dev/null and b/public/images/sites/templates/starter-for-react-native-light.png differ diff --git a/public/images/sites/templates/starter-for-remix-dark.png b/public/images/sites/templates/starter-for-remix-dark.png new file mode 100644 index 0000000000..76e80dde71 Binary files /dev/null and b/public/images/sites/templates/starter-for-remix-dark.png differ diff --git a/public/images/sites/templates/starter-for-remix-light.png b/public/images/sites/templates/starter-for-remix-light.png new file mode 100644 index 0000000000..76e80dde71 Binary files /dev/null and b/public/images/sites/templates/starter-for-remix-light.png differ diff --git a/public/images/sites/templates/starter-for-svelte-dark.png b/public/images/sites/templates/starter-for-svelte-dark.png new file mode 100644 index 0000000000..f25943ae48 Binary files /dev/null and b/public/images/sites/templates/starter-for-svelte-dark.png differ diff --git a/public/images/sites/templates/starter-for-svelte-light.png b/public/images/sites/templates/starter-for-svelte-light.png new file mode 100644 index 0000000000..f25943ae48 Binary files /dev/null and b/public/images/sites/templates/starter-for-svelte-light.png differ diff --git a/public/images/sites/templates/starter-for-vue-dark.png b/public/images/sites/templates/starter-for-vue-dark.png new file mode 100644 index 0000000000..9d9af29f87 Binary files /dev/null and b/public/images/sites/templates/starter-for-vue-dark.png differ diff --git a/public/images/sites/templates/starter-for-vue-light.png b/public/images/sites/templates/starter-for-vue-light.png new file mode 100644 index 0000000000..9d9af29f87 Binary files /dev/null and b/public/images/sites/templates/starter-for-vue-light.png differ diff --git a/public/images/sites/templates/template-for-blog-dark.png b/public/images/sites/templates/template-for-blog-dark.png new file mode 100644 index 0000000000..b076b918a8 Binary files /dev/null and b/public/images/sites/templates/template-for-blog-dark.png differ diff --git a/public/images/sites/templates/template-for-blog-light.png b/public/images/sites/templates/template-for-blog-light.png new file mode 100644 index 0000000000..b076b918a8 Binary files /dev/null and b/public/images/sites/templates/template-for-blog-light.png differ diff --git a/public/images/sites/templates/template-for-documentation-dark.png b/public/images/sites/templates/template-for-documentation-dark.png new file mode 100644 index 0000000000..77e9aa61e4 Binary files /dev/null and b/public/images/sites/templates/template-for-documentation-dark.png differ diff --git a/public/images/sites/templates/template-for-documentation-light.png b/public/images/sites/templates/template-for-documentation-light.png new file mode 100644 index 0000000000..77e9aa61e4 Binary files /dev/null and b/public/images/sites/templates/template-for-documentation-light.png differ diff --git a/public/images/sites/templates/template-for-event-dark.png b/public/images/sites/templates/template-for-event-dark.png new file mode 100644 index 0000000000..c3376d3ff6 Binary files /dev/null and b/public/images/sites/templates/template-for-event-dark.png differ diff --git a/public/images/sites/templates/template-for-event-light.png b/public/images/sites/templates/template-for-event-light.png new file mode 100644 index 0000000000..c97901326a Binary files /dev/null and b/public/images/sites/templates/template-for-event-light.png differ diff --git a/public/images/sites/templates/template-for-portfolio-dark.png b/public/images/sites/templates/template-for-portfolio-dark.png new file mode 100644 index 0000000000..4b4382bf80 Binary files /dev/null and b/public/images/sites/templates/template-for-portfolio-dark.png differ diff --git a/public/images/sites/templates/template-for-portfolio-light.png b/public/images/sites/templates/template-for-portfolio-light.png new file mode 100644 index 0000000000..4b4382bf80 Binary files /dev/null and b/public/images/sites/templates/template-for-portfolio-light.png differ diff --git a/public/images/sites/templates/template-for-store-dark.png b/public/images/sites/templates/template-for-store-dark.png new file mode 100644 index 0000000000..645671ab55 Binary files /dev/null and b/public/images/sites/templates/template-for-store-dark.png differ diff --git a/public/images/sites/templates/template-for-store-light.png b/public/images/sites/templates/template-for-store-light.png new file mode 100644 index 0000000000..645671ab55 Binary files /dev/null and b/public/images/sites/templates/template-for-store-light.png differ diff --git a/public/images/sites/templates/vitepress-dark.png b/public/images/sites/templates/vitepress-dark.png new file mode 100644 index 0000000000..0c68d27461 Binary files /dev/null and b/public/images/sites/templates/vitepress-dark.png differ diff --git a/public/images/sites/templates/vitepress-light.png b/public/images/sites/templates/vitepress-light.png new file mode 100644 index 0000000000..0f93de1c10 Binary files /dev/null and b/public/images/sites/templates/vitepress-light.png differ diff --git a/public/images/sites/templates/vuepress-dark.png b/public/images/sites/templates/vuepress-dark.png new file mode 100644 index 0000000000..52896878be Binary files /dev/null and b/public/images/sites/templates/vuepress-dark.png differ diff --git a/public/images/sites/templates/vuepress-light.png b/public/images/sites/templates/vuepress-light.png new file mode 100644 index 0000000000..52896878be Binary files /dev/null and b/public/images/sites/templates/vuepress-light.png differ diff --git a/public/images/vcs/qr-dark.svg b/public/images/vcs/qr-dark.svg new file mode 100644 index 0000000000..bbbc681f15 --- /dev/null +++ b/public/images/vcs/qr-dark.svg @@ -0,0 +1,18 @@ +<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> +<mask id="path-1-outside-1_6367_338401" maskUnits="userSpaceOnUse" x="0" y="0" width="30" height="30" fill="black"> +<rect fill="white" width="30" height="30"/> +<path d="M1 10.6C1 7.23969 1 5.55953 1.65396 4.27606C2.2292 3.14708 3.14708 2.2292 4.27606 1.65396C5.55953 1 7.23969 1 10.6 1H19.4C22.7603 1 24.4405 1 25.7239 1.65396C26.8529 2.2292 27.7708 3.14708 28.346 4.27606C29 5.55953 29 7.23969 29 10.6V19.4C29 22.7603 29 24.4405 28.346 25.7239C27.7708 26.8529 26.8529 27.7708 25.7239 28.346C24.4405 29 22.7603 29 19.4 29H10.6C7.23969 29 5.55953 29 4.27606 28.346C3.14708 27.7708 2.2292 26.8529 1.65396 25.7239C1 24.4405 1 22.7603 1 19.4V10.6Z"/> +</mask> +<path d="M1 10.6C1 7.23969 1 5.55953 1.65396 4.27606C2.2292 3.14708 3.14708 2.2292 4.27606 1.65396C5.55953 1 7.23969 1 10.6 1H19.4C22.7603 1 24.4405 1 25.7239 1.65396C26.8529 2.2292 27.7708 3.14708 28.346 4.27606C29 5.55953 29 7.23969 29 10.6V19.4C29 22.7603 29 24.4405 28.346 25.7239C27.7708 26.8529 26.8529 27.7708 25.7239 28.346C24.4405 29 22.7603 29 19.4 29H10.6C7.23969 29 5.55953 29 4.27606 28.346C3.14708 27.7708 2.2292 26.8529 1.65396 25.7239C1 24.4405 1 22.7603 1 19.4V10.6Z" fill="#1D1D21"/> +<path d="M4.27606 28.346L4.73005 27.455L4.27606 28.346ZM1.65396 25.7239L0.762954 26.1779L1.65396 25.7239ZM28.346 25.7239L29.237 26.1779L28.346 25.7239ZM25.7239 28.346L26.1779 29.237L25.7239 28.346ZM28.346 4.27606L27.455 4.73005L28.346 4.27606ZM10.6 2H19.4V0H10.6V2ZM28 10.6V19.4H30V10.6H28ZM19.4 28H10.6V30H19.4V28ZM2 19.4V10.6H0V19.4H2ZM10.6 28C8.90334 28 7.69099 27.9992 6.74064 27.9216C5.80197 27.8449 5.20731 27.6982 4.73005 27.455L3.82207 29.237C4.62827 29.6478 5.51543 29.8281 6.57778 29.9149C7.62846 30.0008 8.93634 30 10.6 30V28ZM0 19.4C0 21.0637 -0.000777706 22.3715 0.0850662 23.4222C0.171864 24.4846 0.352173 25.3717 0.762954 26.1779L2.54497 25.27C2.30179 24.7927 2.15512 24.198 2.07842 23.2594C2.00078 22.309 2 21.0967 2 19.4H0ZM4.73005 27.455C3.78924 26.9757 3.02433 26.2108 2.54497 25.27L0.762954 26.1779C1.43407 27.4951 2.50493 28.5659 3.82207 29.237L4.73005 27.455ZM28 19.4C28 21.0967 27.9992 22.309 27.9216 23.2594C27.8449 24.198 27.6982 24.7927 27.455 25.27L29.237 26.1779C29.6478 25.3717 29.8281 24.4846 29.9149 23.4222C30.0008 22.3715 30 21.0637 30 19.4H28ZM19.4 30C21.0637 30 22.3715 30.0008 23.4222 29.9149C24.4846 29.8281 25.3717 29.6478 26.1779 29.237L25.27 27.455C24.7927 27.6982 24.198 27.8449 23.2594 27.9216C22.309 27.9992 21.0967 28 19.4 28V30ZM27.455 25.27C26.9757 26.2108 26.2108 26.9757 25.27 27.455L26.1779 29.237C27.4951 28.5659 28.5659 27.4951 29.237 26.1779L27.455 25.27ZM19.4 2C21.0967 2 22.309 2.00078 23.2594 2.07842C24.198 2.15512 24.7927 2.30179 25.27 2.54497L26.1779 0.762954C25.3717 0.352173 24.4846 0.171864 23.4222 0.0850662C22.3715 -0.000777706 21.0637 0 19.4 0V2ZM30 10.6C30 8.93634 30.0008 7.62846 29.9149 6.57778C29.8281 5.51543 29.6478 4.62827 29.237 3.82207L27.455 4.73005C27.6982 5.20731 27.8449 5.80197 27.9216 6.74064C27.9992 7.69099 28 8.90334 28 10.6H30ZM25.27 2.54497C26.2108 3.02433 26.9757 3.78924 27.455 4.73005L29.237 3.82207C28.5659 2.50493 27.4951 1.43407 26.1779 0.762954L25.27 2.54497ZM10.6 0C8.93634 0 7.62846 -0.000777706 6.57778 0.0850662C5.51543 0.171864 4.62827 0.352173 3.82207 0.762954L4.73005 2.54497C5.20731 2.30179 5.80197 2.15512 6.74064 2.07842C7.69099 2.00078 8.90334 2 10.6 2V0ZM2 10.6C2 8.90334 2.00078 7.69099 2.07842 6.74064C2.15512 5.80197 2.30179 5.20731 2.54497 4.73005L0.762954 3.82207C0.352173 4.62827 0.171864 5.51543 0.0850662 6.57778C-0.000777706 7.62846 0 8.93634 0 10.6H2ZM3.82207 0.762954C2.50493 1.43407 1.43407 2.50493 0.762954 3.82207L2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497L3.82207 0.762954Z" fill="#414146" mask="url(#path-1-outside-1_6367_338401)"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M8 9C8 8.44772 8.44772 8 9 8H12C12.5523 8 13 8.44772 13 9V12C13 12.5523 12.5523 13 12 13H9C8.44772 13 8 12.5523 8 12V9ZM10 11V10H11V11H10Z" fill="#818186"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M8 18C8 17.4477 8.44772 17 9 17H12C12.5523 17 13 17.4477 13 18V21C13 21.5523 12.5523 22 12 22H9C8.44772 22 8 21.5523 8 21V18ZM10 20V19H11V20H10Z" fill="#818186"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C17.4477 8 17 8.44772 17 9V12C17 12.5523 17.4477 13 18 13H21C21.5523 13 22 12.5523 22 12V9C22 8.44772 21.5523 8 21 8H18ZM19 10V11H20V10H19Z" fill="#818186"/> +<path d="M16 9C16 8.44772 15.5523 8 15 8C14.4477 8 14 8.44772 14 9V10C14 10.5523 14.4477 11 15 11C15.5523 11 16 10.5523 16 10V9Z" fill="#818186"/> +<path d="M15 12C15.5523 12 16 12.4477 16 13V14H18C18.5523 14 19 14.4477 19 15C19 15.5523 18.5523 16 18 16H15C14.4477 16 14 15.5523 14 15V13C14 12.4477 14.4477 12 15 12Z" fill="#818186"/> +<path d="M21 14C20.4477 14 20 14.4477 20 15C20 15.5523 20.4477 16 21 16C21.5523 16 22 15.5523 22 15C22 14.4477 21.5523 14 21 14Z" fill="#818186"/> +<path d="M14 18C14 17.4477 14.4477 17 15 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19V21C16 21.5523 15.5523 22 15 22C14.4477 22 14 21.5523 14 21V18Z" fill="#818186"/> +<path d="M12 16C12.5523 16 13 15.5523 13 15C13 14.4477 12.5523 14 12 14H9C8.44772 14 8 14.4477 8 15C8 15.5523 8.44772 16 9 16H12Z" fill="#818186"/> +<path d="M22 18C22 18.5523 21.5523 19 21 19H19C18.4477 19 18 18.5523 18 18C18 17.4477 18.4477 17 19 17H21C21.5523 17 22 17.4477 22 18Z" fill="#818186"/> +<path d="M21 22C21.5523 22 22 21.5523 22 21C22 20.4477 21.5523 20 21 20H18C17.4477 20 17 20.4477 17 21C17 21.5523 17.4477 22 18 22H21Z" fill="#818186"/> +</svg> diff --git a/public/images/vcs/qr-light.svg b/public/images/vcs/qr-light.svg new file mode 100644 index 0000000000..5026db975d --- /dev/null +++ b/public/images/vcs/qr-light.svg @@ -0,0 +1,18 @@ +<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> +<mask id="path-1-outside-1_6367_338394" maskUnits="userSpaceOnUse" x="0" y="0" width="30" height="30" fill="black"> +<rect fill="white" width="30" height="30"/> +<path d="M1 10.6C1 7.23969 1 5.55953 1.65396 4.27606C2.2292 3.14708 3.14708 2.2292 4.27606 1.65396C5.55953 1 7.23969 1 10.6 1H19.4C22.7603 1 24.4405 1 25.7239 1.65396C26.8529 2.2292 27.7708 3.14708 28.346 4.27606C29 5.55953 29 7.23969 29 10.6V19.4C29 22.7603 29 24.4405 28.346 25.7239C27.7708 26.8529 26.8529 27.7708 25.7239 28.346C24.4405 29 22.7603 29 19.4 29H10.6C7.23969 29 5.55953 29 4.27606 28.346C3.14708 27.7708 2.2292 26.8529 1.65396 25.7239C1 24.4405 1 22.7603 1 19.4V10.6Z"/> +</mask> +<path d="M1 10.6C1 7.23969 1 5.55953 1.65396 4.27606C2.2292 3.14708 3.14708 2.2292 4.27606 1.65396C5.55953 1 7.23969 1 10.6 1H19.4C22.7603 1 24.4405 1 25.7239 1.65396C26.8529 2.2292 27.7708 3.14708 28.346 4.27606C29 5.55953 29 7.23969 29 10.6V19.4C29 22.7603 29 24.4405 28.346 25.7239C27.7708 26.8529 26.8529 27.7708 25.7239 28.346C24.4405 29 22.7603 29 19.4 29H10.6C7.23969 29 5.55953 29 4.27606 28.346C3.14708 27.7708 2.2292 26.8529 1.65396 25.7239C1 24.4405 1 22.7603 1 19.4V10.6Z" fill="white"/> +<path d="M4.27606 28.346L4.73005 27.455L4.27606 28.346ZM1.65396 25.7239L0.762954 26.1779L1.65396 25.7239ZM28.346 25.7239L29.237 26.1779L28.346 25.7239ZM25.7239 28.346L26.1779 29.237L25.7239 28.346ZM28.346 4.27606L27.455 4.73005L28.346 4.27606ZM10.6 2H19.4V0H10.6V2ZM28 10.6V19.4H30V10.6H28ZM19.4 28H10.6V30H19.4V28ZM2 19.4V10.6H0V19.4H2ZM10.6 28C8.90334 28 7.69099 27.9992 6.74064 27.9216C5.80197 27.8449 5.20731 27.6982 4.73005 27.455L3.82207 29.237C4.62827 29.6478 5.51543 29.8281 6.57778 29.9149C7.62846 30.0008 8.93634 30 10.6 30V28ZM0 19.4C0 21.0637 -0.000777706 22.3715 0.0850662 23.4222C0.171864 24.4846 0.352173 25.3717 0.762954 26.1779L2.54497 25.27C2.30179 24.7927 2.15512 24.198 2.07842 23.2594C2.00078 22.309 2 21.0967 2 19.4H0ZM4.73005 27.455C3.78924 26.9757 3.02433 26.2108 2.54497 25.27L0.762954 26.1779C1.43407 27.4951 2.50493 28.5659 3.82207 29.237L4.73005 27.455ZM28 19.4C28 21.0967 27.9992 22.309 27.9216 23.2594C27.8449 24.198 27.6982 24.7927 27.455 25.27L29.237 26.1779C29.6478 25.3717 29.8281 24.4846 29.9149 23.4222C30.0008 22.3715 30 21.0637 30 19.4H28ZM19.4 30C21.0637 30 22.3715 30.0008 23.4222 29.9149C24.4846 29.8281 25.3717 29.6478 26.1779 29.237L25.27 27.455C24.7927 27.6982 24.198 27.8449 23.2594 27.9216C22.309 27.9992 21.0967 28 19.4 28V30ZM27.455 25.27C26.9757 26.2108 26.2108 26.9757 25.27 27.455L26.1779 29.237C27.4951 28.5659 28.5659 27.4951 29.237 26.1779L27.455 25.27ZM19.4 2C21.0967 2 22.309 2.00078 23.2594 2.07842C24.198 2.15512 24.7927 2.30179 25.27 2.54497L26.1779 0.762954C25.3717 0.352173 24.4846 0.171864 23.4222 0.0850662C22.3715 -0.000777706 21.0637 0 19.4 0V2ZM30 10.6C30 8.93634 30.0008 7.62846 29.9149 6.57778C29.8281 5.51543 29.6478 4.62827 29.237 3.82207L27.455 4.73005C27.6982 5.20731 27.8449 5.80197 27.9216 6.74064C27.9992 7.69099 28 8.90334 28 10.6H30ZM25.27 2.54497C26.2108 3.02433 26.9757 3.78924 27.455 4.73005L29.237 3.82207C28.5659 2.50493 27.4951 1.43407 26.1779 0.762954L25.27 2.54497ZM10.6 0C8.93634 0 7.62846 -0.000777706 6.57778 0.0850662C5.51543 0.171864 4.62827 0.352173 3.82207 0.762954L4.73005 2.54497C5.20731 2.30179 5.80197 2.15512 6.74064 2.07842C7.69099 2.00078 8.90334 2 10.6 2V0ZM2 10.6C2 8.90334 2.00078 7.69099 2.07842 6.74064C2.15512 5.80197 2.30179 5.20731 2.54497 4.73005L0.762954 3.82207C0.352173 4.62827 0.171864 5.51543 0.0850662 6.57778C-0.000777706 7.62846 0 8.93634 0 10.6H2ZM3.82207 0.762954C2.50493 1.43407 1.43407 2.50493 0.762954 3.82207L2.54497 4.73005C3.02433 3.78924 3.78924 3.02433 4.73005 2.54497L3.82207 0.762954Z" fill="#D8D8DB" mask="url(#path-1-outside-1_6367_338394)"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M8 9C8 8.44772 8.44772 8 9 8H12C12.5523 8 13 8.44772 13 9V12C13 12.5523 12.5523 13 12 13H9C8.44772 13 8 12.5523 8 12V9ZM10 11V10H11V11H10Z" fill="#97979B"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M8 18C8 17.4477 8.44772 17 9 17H12C12.5523 17 13 17.4477 13 18V21C13 21.5523 12.5523 22 12 22H9C8.44772 22 8 21.5523 8 21V18ZM10 20V19H11V20H10Z" fill="#97979B"/> +<path fill-rule="evenodd" clip-rule="evenodd" d="M18 8C17.4477 8 17 8.44772 17 9V12C17 12.5523 17.4477 13 18 13H21C21.5523 13 22 12.5523 22 12V9C22 8.44772 21.5523 8 21 8H18ZM19 10V11H20V10H19Z" fill="#97979B"/> +<path d="M16 9C16 8.44772 15.5523 8 15 8C14.4477 8 14 8.44772 14 9V10C14 10.5523 14.4477 11 15 11C15.5523 11 16 10.5523 16 10V9Z" fill="#97979B"/> +<path d="M15 12C15.5523 12 16 12.4477 16 13V14H18C18.5523 14 19 14.4477 19 15C19 15.5523 18.5523 16 18 16H15C14.4477 16 14 15.5523 14 15V13C14 12.4477 14.4477 12 15 12Z" fill="#97979B"/> +<path d="M21 14C20.4477 14 20 14.4477 20 15C20 15.5523 20.4477 16 21 16C21.5523 16 22 15.5523 22 15C22 14.4477 21.5523 14 21 14Z" fill="#97979B"/> +<path d="M14 18C14 17.4477 14.4477 17 15 17H16C16.5523 17 17 17.4477 17 18C17 18.5523 16.5523 19 16 19V21C16 21.5523 15.5523 22 15 22C14.4477 22 14 21.5523 14 21V18Z" fill="#97979B"/> +<path d="M12 16C12.5523 16 13 15.5523 13 15C13 14.4477 12.5523 14 12 14H9C8.44772 14 8 14.4477 8 15C8 15.5523 8.44772 16 9 16H12Z" fill="#97979B"/> +<path d="M22 18C22 18.5523 21.5523 19 21 19H19C18.4477 19 18 18.5523 18 18C18 17.4477 18.4477 17 19 17H21C21.5523 17 22 17.4477 22 18Z" fill="#97979B"/> +<path d="M21 22C21.5523 22 22 21.5523 22 21C22 20.4477 21.5523 20 21 20H18C17.4477 20 17 20.4477 17 21C17 21.5523 17.4477 22 18 22H21Z" fill="#97979B"/> +</svg> diff --git a/public/images/vcs/status-building-dark.gif b/public/images/vcs/status-building-dark.gif new file mode 100644 index 0000000000..6d4afe72a1 Binary files /dev/null and b/public/images/vcs/status-building-dark.gif differ diff --git a/public/images/vcs/status-building-light.gif b/public/images/vcs/status-building-light.gif new file mode 100644 index 0000000000..c64a7643c1 Binary files /dev/null and b/public/images/vcs/status-building-light.gif differ diff --git a/public/images/vcs/status-failed-dark.png b/public/images/vcs/status-failed-dark.png new file mode 100644 index 0000000000..c6508e93bc Binary files /dev/null and b/public/images/vcs/status-failed-dark.png differ diff --git a/public/images/vcs/status-failed-light.png b/public/images/vcs/status-failed-light.png new file mode 100644 index 0000000000..0e4d4533d0 Binary files /dev/null and b/public/images/vcs/status-failed-light.png differ diff --git a/public/images/vcs/status-ready-dark.png b/public/images/vcs/status-ready-dark.png new file mode 100644 index 0000000000..7408fb0cba Binary files /dev/null and b/public/images/vcs/status-ready-dark.png differ diff --git a/public/images/vcs/status-ready-light.png b/public/images/vcs/status-ready-light.png new file mode 100644 index 0000000000..87e141fcfe Binary files /dev/null and b/public/images/vcs/status-ready-light.png differ diff --git a/public/images/vcs/status-waiting-dark.png b/public/images/vcs/status-waiting-dark.png new file mode 100644 index 0000000000..29a4ee540c Binary files /dev/null and b/public/images/vcs/status-waiting-dark.png differ diff --git a/public/images/vcs/status-waiting-light.png b/public/images/vcs/status-waiting-light.png new file mode 100644 index 0000000000..676d530cf4 Binary files /dev/null and b/public/images/vcs/status-waiting-light.png differ diff --git a/src/Appwrite/Auth/Auth.php b/src/Appwrite/Auth/Auth.php index 8555d5cb00..9af5045fa4 100644 --- a/src/Appwrite/Auth/Auth.php +++ b/src/Appwrite/Auth/Auth.php @@ -103,6 +103,11 @@ class Auth */ public static $cookieName = 'a_session'; + /** + * @var string + */ + public static $cookieNamePreview = 'a_jwt_console'; + /** * User Unique ID. * diff --git a/src/Appwrite/Auth/Key.php b/src/Appwrite/Auth/Key.php index 1c40b35f54..44a75a6ee3 100644 --- a/src/Appwrite/Auth/Key.php +++ b/src/Appwrite/Auth/Key.php @@ -20,6 +20,11 @@ class Key protected string $name, protected bool $expired = false, protected array $disabledMetrics = [], + protected bool $hostnameOverride = false, + protected bool $bannerDisabled = false, + protected bool $projectCheckDisabled = false, + protected bool $previewAuthDisabled = false, + protected bool $deploymentStatusIgnored = false, ) { } @@ -58,6 +63,33 @@ class Key return $this->disabledMetrics; } + + public function getHostnameOverride(): bool + { + return $this->hostnameOverride; + } + + + public function isBannerDisabled(): bool + { + return $this->bannerDisabled; + } + + public function isPreviewAuthDisabled(): bool + { + return $this->previewAuthDisabled; + } + + public function isDeploymentStatusIgnored(): bool + { + return $this->deploymentStatusIgnored; + } + + public function isProjectCheckDisabled(): bool + { + return $this->projectCheckDisabled; + } + /** * Decode the given secret key into a Key object, containing the project ID, type, role, scopes, and name. * Can be a stored API key or a dynamic key (JWT). @@ -109,9 +141,14 @@ class Key $name = $payload['name'] ?? 'Dynamic Key'; $projectId = $payload['projectId'] ?? ''; $disabledMetrics = $payload['disabledMetrics'] ?? []; + $hostnameOverride = $payload['hostnameOverride'] ?? false; + $bannerDisabled = $payload['bannerDisabled'] ?? false; + $projectCheckDisabled = $payload['projectCheckDisabled'] ?? false; + $previewAuthDisabled = $payload['previewAuthDisabled'] ?? false; + $deploymentStatusIgnored = $payload['deploymentStatusIgnored'] ?? false; $scopes = \array_merge($payload['scopes'] ?? [], $scopes); - if ($projectId !== $project->getId()) { + if (!$projectCheckDisabled && $projectId !== $project->getId()) { return $guestKey; } @@ -122,7 +159,12 @@ class Key $scopes, $name, $expired, - $disabledMetrics + $disabledMetrics, + $hostnameOverride, + $bannerDisabled, + $projectCheckDisabled, + $previewAuthDisabled, + $deploymentStatusIgnored ); case API_KEY_STANDARD: $key = $project->find( diff --git a/src/Appwrite/Event/Realtime.php b/src/Appwrite/Event/Realtime.php index b77df580f8..4d8c9a321b 100644 --- a/src/Appwrite/Event/Realtime.php +++ b/src/Appwrite/Event/Realtime.php @@ -42,7 +42,7 @@ class Realtime extends Event * Set subscribers for this realtime event. * * @param array $subscribers - * @return array + * @return self */ public function setSubscribers(array $subscribers): self { diff --git a/src/Appwrite/Extend/Exception.php b/src/Appwrite/Extend/Exception.php index 2db5a840bc..296434ed57 100644 --- a/src/Appwrite/Extend/Exception.php +++ b/src/Appwrite/Extend/Exception.php @@ -118,6 +118,9 @@ class Exception extends \Exception public const TEAM_INVITE_MISMATCH = 'team_invite_mismatch'; public const TEAM_ALREADY_EXISTS = 'team_already_exists'; + /** Console */ + public const RESOURCE_ALREADY_EXISTS = 'resource_already_exists'; + /** Membership */ public const MEMBERSHIP_NOT_FOUND = 'membership_not_found'; public const MEMBERSHIP_ALREADY_CONFIRMED = 'membership_already_confirmed'; @@ -151,12 +154,18 @@ class Exception extends \Exception public const PROVIDER_CONTRIBUTION_CONFLICT = 'provider_contribution_conflict'; public const GENERAL_PROVIDER_FAILURE = 'general_provider_failure'; + /** Sites */ + public const SITE_NOT_FOUND = 'site_not_found'; + public const SITE_TEMPLATE_NOT_FOUND = 'site_template_not_found'; + /** Functions */ public const FUNCTION_NOT_FOUND = 'function_not_found'; public const FUNCTION_RUNTIME_UNSUPPORTED = 'function_runtime_unsupported'; public const FUNCTION_ENTRYPOINT_MISSING = 'function_entrypoint_missing'; public const FUNCTION_SYNCHRONOUS_TIMEOUT = 'function_synchronous_timeout'; public const FUNCTION_TEMPLATE_NOT_FOUND = 'function_template_not_found'; + public const FUNCTION_RUNTIME_NOT_DETECTED = 'function_runtime_not_detected'; + public const FUNCTION_EXECUTE_PERMISSION_MISSING = 'function_execute_permission_missing'; /** Deployments */ public const DEPLOYMENT_NOT_FOUND = 'deployment_not_found'; @@ -166,11 +175,16 @@ class Exception extends \Exception public const BUILD_NOT_READY = 'build_not_ready'; public const BUILD_IN_PROGRESS = 'build_in_progress'; public const BUILD_ALREADY_COMPLETED = 'build_already_completed'; + public const BUILD_CANCELED = 'build_canceled'; + public const BUILD_FAILED = 'build_failed'; /** Execution */ public const EXECUTION_NOT_FOUND = 'execution_not_found'; public const EXECUTION_IN_PROGRESS = 'execution_in_progress'; + /** Log */ + public const LOG_NOT_FOUND = 'log_not_found'; + /** Databases */ public const DATABASE_NOT_FOUND = 'database_not_found'; public const DATABASE_ALREADY_EXISTS = 'database_already_exists'; @@ -248,6 +262,7 @@ class Exception extends \Exception /** Variables */ public const VARIABLE_NOT_FOUND = 'variable_not_found'; public const VARIABLE_ALREADY_EXISTS = 'variable_already_exists'; + public const VARIABLE_CANNOT_UNSET_SECRET = 'variable_cannot_unset_secret'; /** Platform */ public const PLATFORM_NOT_FOUND = 'platform_not_found'; @@ -304,15 +319,22 @@ class Exception extends \Exception /** Schedules */ public const SCHEDULE_NOT_FOUND = 'schedule_not_found'; + /** Tokens */ + public const TOKEN_NOT_FOUND = 'token_not_found'; + public const TOKEN_EXPIRED = 'token_expired'; + public const TOKEN_RESOURCE_TYPE_INVALID = 'token_resource_type_invalid'; protected string $type = ''; protected array $errors = []; protected bool $publish; + private array $ctas = []; + private ?string $view = null; - public function __construct(string $type = Exception::GENERAL_UNKNOWN, string $message = null, int|string $code = null, \Throwable $previous = null) + public function __construct(string $type = Exception::GENERAL_UNKNOWN, string $message = null, int|string $code = null, \Throwable $previous = null, ?string $view = null) { $this->errors = Config::getParam('errors'); $this->type = $type; + $this->view = $view; $this->code = $code ?? $this->errors[$type]['code']; // Mark string errors like HY001 from PDO as 500 errors @@ -362,4 +384,23 @@ class Exception extends \Exception { return $this->publish; } + + public function addCTA(string $label, ?string $url = null): self + { + $this->ctas[] = [ + 'label' => $label, + 'url' => $url + ]; + return $this; + } + + public function getCTAs(): array + { + return $this->ctas; + } + + public function getView(): ?string + { + return $this->view; + } } diff --git a/src/Appwrite/Messaging/Adapter/Realtime.php b/src/Appwrite/Messaging/Adapter/Realtime.php index 1963bdedd6..568132ceb1 100644 --- a/src/Appwrite/Messaging/Adapter/Realtime.php +++ b/src/Appwrite/Messaging/Adapter/Realtime.php @@ -352,6 +352,16 @@ class Realtime extends Adapter $roles = [Role::team($project->getAttribute('teamId'))->toString()]; } + break; + + case 'sites': + if ($parts[2] === 'deployments') { + $channels[] = 'console'; + $channels[] = 'projects.' . $project->getId(); + $projectId = 'console'; + $roles = [Role::team($project->getAttribute('teamId'))->toString()]; + } + break; case 'migrations': $channels[] = 'console'; diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 1e3625b5a3..0b1e462d8e 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -3,48 +3,37 @@ namespace Appwrite\Migration; use Exception; -use Swoole\Runtime; use Utopia\CLI\Console; use Utopia\Config\Config; use Utopia\Database\Database; use Utopia\Database\Document; +use Utopia\Database\Exception\Conflict; +use Utopia\Database\Exception\Duplicate; +use Utopia\Database\Exception\Limit; +use Utopia\Database\Exception\Structure; use Utopia\Database\Helpers\ID; use Utopia\Database\PDO; -use Utopia\Database\Query; use Utopia\Database\Validator\Authorization; -use Utopia\System\System; - -Runtime::enableCoroutine(SWOOLE_HOOK_ALL); abstract class Migration { - /** - * @var int - */ protected int $limit = 100; - /** - * @var Document - */ protected Document $project; - /** - * @var Database - */ - protected Database $projectDB; + protected Database $dbForProject; + + protected Database $dbForPlatform; /** - * @var Database + * @var callable(Document): Database */ - protected Database $consoleDB; + protected mixed $getProjectDB; - /** - * @var PDO - */ protected PDO $pdo; /** - * @var array + * @var array<string, string> */ public static array $versions = [ '1.0.0-RC1' => 'V15', @@ -94,10 +83,12 @@ abstract class Migration '1.6.0' => 'V21', '1.6.1' => 'V21', '1.6.2' => 'V21', + '1.7.0-RC1' => 'V22', + '1.7.0' => 'V22', ]; /** - * @var array + * @var array<string, array<string, mixed>> */ protected array $collections; @@ -108,38 +99,35 @@ abstract class Migration $this->collections = Config::getParam('collections', []); - $projectCollections = $this->collections['projects']; + $this->collections['projects']['_metadata'] = [ + '$id' => ID::custom('_metadata'), + '$collection' => Database::METADATA, + ]; - $this->collections['projects'] = array_merge([ - '_metadata' => [ - '$id' => ID::custom('_metadata'), - '$collection' => Database::METADATA - ], - 'audit' => [ - '$id' => ID::custom('audit'), - '$collection' => Database::METADATA - ], - 'abuse' => [ - '$id' => ID::custom('abuse'), - '$collection' => Database::METADATA - ] - ], $projectCollections); + $this->collections['projects']['audit'] = [ + '$id' => ID::custom('audit'), + '$collection' => Database::METADATA, + ]; } /** * Set project for migration. * * @param Document $project - * @param Database $projectDB - * @param Database $oldConsoleDB - * + * @param Database $dbForProject + * @param Database $dbForPlatform * @return self */ - public function setProject(Document $project, Database $projectDB, Database $consoleDB): self - { + public function setProject( + Document $project, + Database $dbForProject, + Database $dbForPlatform, + ?callable $getProjectDB = null + ): self { $this->project = $project; - $this->projectDB = $projectDB; - $this->consoleDB = $consoleDB; + $this->dbForProject = $dbForProject; + $this->dbForPlatform = $dbForPlatform; + $this->getProjectDB = $getProjectDB; return $this; } @@ -148,7 +136,7 @@ abstract class Migration * Set PDO for Migration. * * @param PDO $pdo - * @return \Appwrite\Migration\Migration + * @return Migration */ public function setPDO(PDO $pdo): self { @@ -161,87 +149,49 @@ abstract class Migration * Iterates through every document. * * @param callable $callback + * @throws Exception */ public function forEachDocument(callable $callback): void { - $internalProjectId = $this->project->getInternalId(); + $projectInternalId = $this->project->getInternalId(); - $collections = match ($internalProjectId) { + $collections = match ($projectInternalId) { 'console' => $this->collections['console'], default => $this->collections['projects'], }; foreach ($collections as $collection) { + // Only migrate top-level collections if ($collection['$collection'] !== Database::METADATA) { continue; } - Console::log('Migrating Collection ' . $collection['$id'] . ':'); + Console::log('Migrating documents for collection "' . $collection['$id'] . '"'); - foreach ($this->documentsIterator($collection['$id']) as $document) { - go(function (Document $document, callable $callback) { - if (empty($document->getId()) || empty($document->getCollection())) { - return; - } - - $old = $document->getArrayCopy(); - $new = call_user_func($callback, $document); - - if (is_null($new) || $new->getArrayCopy() == $old) { - return; - } - - try { - $this->projectDB->updateDocument($document->getCollection(), $document->getId(), $document); - } catch (\Throwable $th) { - Console::error('Failed to update document: ' . $th->getMessage()); - return; - } - }, $document, $callback); - } - } - } - - /** - * Provides an iterator for all documents on a collection. - * - * @param string $collectionId - * @return iterable<Document> - * @throws \Exception - */ - public function documentsIterator(string $collectionId, $queries = []): iterable - { - $sum = 0; - $nextDocument = null; - $collectionCount = $this->projectDB->count($collectionId); - $queries[] = Query::limit($this->limit); - - do { - if ($nextDocument !== null) { - $cursorQueryIndex = \array_search('cursorAfter', \array_map(fn (Query $query) => $query->getMethod(), $queries)); - - if ($cursorQueryIndex !== false) { - $queries[$cursorQueryIndex] = Query::cursorAfter($nextDocument); - } else { - $queries[] = Query::cursorAfter($nextDocument); + $this->dbForProject->foreach($collection['$id'], function (Document $document) use ($collection, $callback) { + if (empty($document->getId()) || empty($document->getCollection())) { + return; } - } - $documents = $this->projectDB->find($collectionId, $queries); - $count = count($documents); - $sum += $count; + $old = $document->getArrayCopy(); + $new = $callback($document); - Console::log($sum . ' / ' . $collectionCount); - foreach ($documents as $document) { - yield $document; - } + if ($new === null || $new->getArrayCopy() == $old) { + return; + } - if ($count !== $this->limit) { - $nextDocument = null; - } else { - $nextDocument = end($documents); - } - } while (!is_null($nextDocument)); + try { + $this->dbForProject->updateDocument( + $document->getCollection(), + $document->getId(), + $document + ); + } catch (\Throwable $th) { + Console::error("Failed to update document \"{$document->getId()}\" in collection \"{$collection['$id']}\":" . $th->getMessage()); + return; + } + }); + } } /** @@ -261,55 +211,50 @@ abstract class Migration default => 'projects', }; - if (!$this->projectDB->exists(System::getEnv('_APP_DB_SCHEMA', 'appwrite'), $name)) { - $attributes = []; - $indexes = []; - $collection = $this->collections[$collectionType][$id]; + if (!$this->dbForProject->getCollection($id)->isEmpty()) { + return; + } - foreach ($collection['attributes'] as $attribute) { - $attributes[] = new Document([ - '$id' => $attribute['$id'], - 'type' => $attribute['type'], - 'size' => $attribute['size'], - 'required' => $attribute['required'], - 'default' => $attribute['default'] ?? null, - 'signed' => $attribute['signed'], - 'array' => $attribute['array'], - 'filters' => $attribute['filters'], - ]); - } + $collection = $this->collections[$collectionType][$id]; - foreach ($collection['indexes'] as $index) { - $indexes[] = new Document([ - '$id' => $index['$id'], - 'type' => $index['type'], - 'attributes' => $index['attributes'], - 'lengths' => $index['lengths'], - 'orders' => $index['orders'], - ]); - } + $attributes = []; + foreach ($collection['attributes'] as $attribute) { + $attributes[] = new Document($attribute); + } - try { - $this->projectDB->createCollection($name, $attributes, $indexes); - } catch (\Throwable $th) { - throw $th; - } + $indexes = []; + foreach ($collection['indexes'] as $index) { + $indexes[] = new Document($index); + } + + try { + $this->dbForProject->createCollection($name, $attributes, $indexes); + } catch (Duplicate) { + Console::warning('Failed to create collection "' . $name . '": Collection already exists'); } } /** - * Creates attribute from collections.php + * Creates attributes from collections.php * - * @param \Utopia\Database\Database $database + * @param Database $database * @param string $collectionId - * @param string $attributeId + * @param array $attributeIds + * @param string|null $from * @return void - * @throws \Exception - * @throws \Utopia\Database\Exception\Duplicate - * @throws \Utopia\Database\Exception\Limit + * @throws \Utopia\Database\Exception + * @throws \Utopia\Database\Exception\Authorization + * @throws Conflict + * @throws Duplicate + * @throws Limit + * @throws Structure */ - public function createAttributeFromCollection(Database $database, string $collectionId, string $attributeId, string $from = null): void - { + public function createAttributesFromCollection( + Database $database, + string $collectionId, + array $attributeIds, + string $from = null + ): void { $from ??= $collectionId; $collectionType = match ($this->project->getInternalId()) { @@ -323,13 +268,78 @@ abstract class Migration $collection = $this->collections[$collectionType][$from] ?? null; - if (is_null($collection)) { + if ($collection === null) { + throw new Exception("Collection {$from} not found"); + } + + $attributesToCreate = []; + $attributes = $collection['attributes']; + $attributeKeys = \array_column($collection['attributes'], '$id'); + + foreach ($attributeIds as $attributeId) { + $attributeKey = \array_search($attributeId, $attributeKeys); + + if ($attributeKey === false) { + throw new Exception("Attribute {$attributeId} not found"); + } + + $attribute = $attributes[$attributeKey]; + $attribute['filters'] ??= []; + $attribute['default'] ??= null; + $attribute['default'] = \in_array('json', $attribute['filters']) + ? \json_encode($attribute['default']) + : $attribute['default']; + + $attributesToCreate[] = $attribute; + } + + $database->createAttributes( + collection: $collectionId, + attributes: $attributesToCreate, + ); + } + + /** + * Creates attribute from collections.php + * + * @param Database $database + * @param string $collectionId + * @param string $attributeId + * @param string|null $from + * @return void + * @throws \Utopia\Database\Exception + * @throws \Utopia\Database\Exception\Authorization + * @throws Conflict + * @throws Duplicate + * @throws Limit + * @throws Structure + */ + public function createAttributeFromCollection( + Database $database, + string $collectionId, + string $attributeId, + string $from = null + ): void { + $from ??= $collectionId; + + $collectionType = match ($this->project->getInternalId()) { + 'console' => 'console', + default => 'projects', + }; + + if ($from === 'files') { + $collectionType = 'buckets'; + } + + $collection = $this->collections[$collectionType][$from] ?? null; + + if ($collection === null) { throw new Exception("Collection {$from} not found"); } $attributes = $collection['attributes']; - $attributeKey = array_search($attributeId, array_column($attributes, '$id')); + $attributeKey = \array_search($attributeId, \array_column($attributes, '$id')); if ($attributeKey === false) { throw new Exception("Attribute {$attributeId} not found"); @@ -344,9 +354,9 @@ abstract class Migration id: $attributeId, type: $attribute['type'], size: $attribute['size'], - required: $attribute['required'] ?? false, - default: in_array('json', $filters) ? json_encode($default) : $default, - signed: $attribute['signed'] ?? false, + required: $attribute['required'], + default: \in_array('json', $filters) ? \json_encode($default) : $default, + signed: $attribute['signed'] ?? true, array: $attribute['array'] ?? false, format: $attribute['format'] ?? '', formatOptions: $attribute['formatOptions'] ?? [], @@ -357,14 +367,14 @@ abstract class Migration /** * Creates index from collections.php * - * @param \Utopia\Database\Database $database + * @param Database $database * @param string $collectionId * @param string $indexId * @param string|null $from * @return void * @throws \Exception - * @throws \Utopia\Database\Exception\Duplicate - * @throws \Utopia\Database\Exception\Limit + * @throws Duplicate + * @throws Limit */ public function createIndexFromCollection(Database $database, string $collectionId, string $indexId, string $from = null): void { @@ -381,13 +391,13 @@ abstract class Migration $collection = $this->collections[$collectionType][$from] ?? null; - if (is_null($collection)) { + if ($collection === null) { throw new Exception("Collection {$collectionId} not found"); } $indexes = $collection['indexes']; - $indexKey = array_search($indexId, array_column($indexes, '$id')); + $indexKey = \array_search($indexId, \array_column($indexes, '$id')); if ($indexKey === false) { throw new Exception("Index {$indexId} not found"); @@ -412,10 +422,11 @@ abstract class Migration * @param string $attribute * @param string $type * @return void + * @throws \Utopia\Database\Exception */ protected function changeAttributeInternalType(string $collection, string $attribute, string $type): void { - $stmt = $this->pdo->prepare("ALTER TABLE `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}_{$collection}` MODIFY `$attribute` $type;"); + $stmt = $this->pdo->prepare("ALTER TABLE `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}_{$collection}` MODIFY `$attribute` $type;"); try { $stmt->execute(); diff --git a/src/Appwrite/Migration/Version/V15.php b/src/Appwrite/Migration/Version/V15.php index ca20b6d7b3..8eab916f19 100644 --- a/src/Appwrite/Migration/Version/V15.php +++ b/src/Appwrite/Migration/Version/V15.php @@ -114,7 +114,7 @@ class V15 extends Migration $bucket->setAttribute('compression', 'none'); } - $this->projectDB->updateDocument('buckets', $bucket->getId(), $bucket); + $this->dbForProject->updateDocument('buckets', $bucket->getId(), $bucket); /** * Migrating stats for every Bucket. @@ -134,13 +134,13 @@ class V15 extends Migration table: $bucketTable, addCreatePermission: false ); - $this->projectDB->updateDocument($bucketTable, $file->getId(), $file); + $this->dbForProject->updateDocument($bucketTable, $file->getId(), $file); } $this->removeWritePermissions($bucketTable); } try { - $this->projectDB->deleteAttribute('buckets', 'permission'); + $this->dbForProject->deleteAttribute('buckets', 'permission'); } catch (\Throwable $th) { Console::warning("'permissions' from buckets: {$th->getMessage()}"); } @@ -188,10 +188,10 @@ class V15 extends Migration addCreatePermission: false ); - $this->projectDB->updateDocument('databases', $database->getId(), $database); + $this->dbForProject->updateDocument('databases', $database->getId(), $database); try { - $this->createAttributeFromCollection($this->projectDB, $databaseTable, 'documentSecurity', 'collections'); + $this->createAttributeFromCollection($this->dbForProject, $databaseTable, 'documentSecurity', 'collections'); } catch (\Throwable $th) { Console::warning("'documentSecurity' from {$databaseTable}: {$th->getMessage()}"); } @@ -231,7 +231,7 @@ class V15 extends Migration $collection->setAttribute('documentSecurity', $collection->getAttribute('permissions') === 'document'); } - $this->projectDB->updateDocument($databaseTable, $collection->getId(), $collection); + $this->dbForProject->updateDocument($databaseTable, $collection->getId(), $collection); /** * Migrating stats for single Collections. @@ -270,14 +270,14 @@ class V15 extends Migration addCreatePermission: false ); - $this->projectDB->updateDocument($collectionTable, $document->getId(), $document); + $this->dbForProject->updateDocument($collectionTable, $document->getId(), $document); } $this->removeWritePermissions($collectionTable); } $this->removeWritePermissions($databaseTable); try { - $this->projectDB->deleteAttribute("database_{$database->getInternalId()}", 'permission'); + $this->dbForProject->deleteAttribute("database_{$database->getInternalId()}", 'permission'); } catch (\Throwable $th) { Console::warning("'permission' from {$databaseTable}: {$th->getMessage()}"); } @@ -293,7 +293,7 @@ class V15 extends Migration protected function removeWritePermissions(string $table): void { try { - $this->pdo->prepare("DELETE FROM `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}_perms` WHERE _type = 'write'")->execute(); + $this->pdo->prepare("DELETE FROM `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}_perms` WHERE _type = 'write'")->execute(); } catch (\Throwable $th) { Console::warning("Remove 'write' permissions from {$table}: {$th->getMessage()}"); } @@ -309,7 +309,7 @@ class V15 extends Migration */ protected function getSQLColumnTypes(string $table): array { - $query = $this->pdo->prepare("SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '_{$this->project->getInternalId()}_{$table}' AND table_schema = '{$this->projectDB->getDatabase()}'"); + $query = $this->pdo->prepare("SELECT COLUMN_NAME, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '_{$this->project->getInternalId()}_{$table}' AND table_schema = '{$this->dbForProject->getDatabase()}'"); $query->execute(); return array_reduce($query->fetchAll(), function (array $carry, array $item) { @@ -331,8 +331,8 @@ class V15 extends Migration if ($columns[$attribute] === 'int') { try { - $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}` MODIFY {$attribute} VARCHAR(64)")->execute(); - $this->pdo->prepare("UPDATE `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}` SET {$attribute} = IF({$attribute} = 0, NULL, FROM_UNIXTIME({$attribute}))")->execute(); + $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}` MODIFY {$attribute} VARCHAR(64)")->execute(); + $this->pdo->prepare("UPDATE `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}` SET {$attribute} = IF({$attribute} = 0, NULL, FROM_UNIXTIME({$attribute}))")->execute(); $columns[$attribute] = 'varchar'; } catch (\Throwable $th) { Console::warning($th->getMessage()); @@ -341,7 +341,7 @@ class V15 extends Migration if ($columns[$attribute] === 'varchar') { try { - $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}` MODIFY {$attribute} DATETIME(3)")->execute(); + $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}` MODIFY {$attribute} DATETIME(3)")->execute(); } catch (\Throwable $th) { Console::warning($th->getMessage()); } @@ -355,11 +355,11 @@ class V15 extends Migration /** * Add datetime filter. */ - $this->projectDB->updateAttributeFilters($table, ID::custom($attribute), ['datetime']); + $this->dbForProject->updateAttributeFilters($table, ID::custom($attribute), ['datetime']); /** * Change data type to DateTime. */ - $this->projectDB->updateAttribute( + $this->dbForProject->updateAttribute( collection: $table, id: $attribute, type: Database::VAR_DATETIME, @@ -370,7 +370,7 @@ class V15 extends Migration } } - $this->projectDB->purgeCachedCollection($table); + $this->dbForProject->purgeCachedCollection($table); } /** @@ -387,7 +387,7 @@ class V15 extends Migration if (!array_key_exists('_permissions', $columns)) { try { - $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}` ADD `_permissions` MEDIUMTEXT DEFAULT NULL")->execute(); + $this->pdo->prepare("ALTER TABLE IF EXISTS `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}` ADD `_permissions` MEDIUMTEXT DEFAULT NULL")->execute(); } catch (\Throwable $th) { Console::warning("Add '_permissions' column to '{$table}': {$th->getMessage()}"); } @@ -408,7 +408,7 @@ class V15 extends Migration { $table ??= $document->getCollection(); - $query = $this->pdo->prepare("SELECT * FROM `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}_perms` WHERE _document = '{$document->getId()}'"); + $query = $this->pdo->prepare("SELECT * FROM `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}_{$table}_perms` WHERE _document = '{$document->getId()}'"); $query->execute(); $results = $query->fetchAll(); $permissions = []; @@ -466,7 +466,7 @@ class V15 extends Migration Console::log("Migrating Collection \"{$id}\""); - $this->projectDB->setNamespace("_{$this->project->getInternalId()}"); + $this->dbForProject->setNamespace("_{$this->project->getInternalId()}"); switch ($id) { case '_metadata': @@ -477,7 +477,7 @@ class V15 extends Migration $this->createCollection('cache'); Console::log('Created new Collection "variables" collection'); $this->createCollection('variables'); - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'abuse': @@ -509,7 +509,7 @@ class V15 extends Migration /** * Create 'compression' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'compression'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'compression'); } catch (\Throwable $th) { Console::warning("'compression' from {$id}: {$th->getMessage()}"); } @@ -518,7 +518,7 @@ class V15 extends Migration /** * Create 'fileSecurity' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'fileSecurity'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'fileSecurity'); } catch (\Throwable $th) { Console::warning("'fileSecurity' from {$id}: {$th->getMessage()}"); } @@ -527,7 +527,7 @@ class V15 extends Migration /** * Create '_key_enabled' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_enabled'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_enabled'); } catch (\Throwable $th) { Console::warning("'_key_enabled' from {$id}: {$th->getMessage()}"); } @@ -536,7 +536,7 @@ class V15 extends Migration /** * Create '_key_name' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_name'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_name'); } catch (\Throwable $th) { Console::warning("'_key_name' from {$id}: {$th->getMessage()}"); } @@ -545,7 +545,7 @@ class V15 extends Migration /** * Create '_key_fileSecurity' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_fileSecurity'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_fileSecurity'); } catch (\Throwable $th) { Console::warning("'_key_fileSecurity' from {$id}: {$th->getMessage()}"); } @@ -554,7 +554,7 @@ class V15 extends Migration /** * Create '_key_maximumFileSize' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_maximumFileSize'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_maximumFileSize'); } catch (\Throwable $th) { Console::warning("'_key_maximumFileSize' from {$id}: {$th->getMessage()}"); } @@ -563,7 +563,7 @@ class V15 extends Migration /** * Create '_key_encryption' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_encryption'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_encryption'); } catch (\Throwable $th) { Console::warning("'_key_encryption' from {$id}: {$th->getMessage()}"); } @@ -572,7 +572,7 @@ class V15 extends Migration /** * Create '_key_antivirus' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_antivirus'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_antivirus'); } catch (\Throwable $th) { Console::warning("'_key_antivirus' from {$id}: {$th->getMessage()}"); } @@ -611,7 +611,7 @@ class V15 extends Migration /** * Create '_key_entrypoint' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_entrypoint'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_entrypoint'); } catch (\Throwable $th) { Console::warning("'_key_entrypoint' from {$id}: {$th->getMessage()}"); } @@ -620,7 +620,7 @@ class V15 extends Migration /** * Create '_key_size' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_size'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_size'); } catch (\Throwable $th) { Console::warning("'_key_size' from {$id}: {$th->getMessage()}"); } @@ -629,7 +629,7 @@ class V15 extends Migration /** * Create '_key_buildId' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_buildId'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_buildId'); } catch (\Throwable $th) { Console::warning("'_key_buildId' from {$id}: {$th->getMessage()}"); } @@ -638,7 +638,7 @@ class V15 extends Migration /** * Create '_key_activate' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_activate'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_activate'); } catch (\Throwable $th) { Console::warning("'_key_activate' from {$id}: {$th->getMessage()}"); } @@ -662,7 +662,7 @@ class V15 extends Migration /** * Create 'stdout' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'stdout'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'stdout'); } catch (\Throwable $th) { Console::warning("'stdout' from {$id}: {$th->getMessage()}"); } @@ -671,7 +671,7 @@ class V15 extends Migration /** * Rename 'time' to 'duration' */ - $this->projectDB->renameAttribute($id, 'time', 'duration'); + $this->dbForProject->renameAttribute($id, 'time', 'duration'); } catch (\Throwable $th) { Console::warning("'duration' from {$id}: {$th->getMessage()}"); } @@ -680,7 +680,7 @@ class V15 extends Migration /** * Create '_key_trigger' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_trigger'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_trigger'); } catch (\Throwable $th) { Console::warning("'_key_trigger' from {$id}: {$th->getMessage()}"); } @@ -689,7 +689,7 @@ class V15 extends Migration /** * Create '_key_status' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_status'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_status'); } catch (\Throwable $th) { Console::warning("'_key_status' from {$id}: {$th->getMessage()}"); } @@ -698,7 +698,7 @@ class V15 extends Migration /** * Create '_key_statusCode' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_statusCode'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_statusCode'); } catch (\Throwable $th) { Console::warning("'_key_statusCode' from {$id}: {$th->getMessage()}"); } @@ -707,7 +707,7 @@ class V15 extends Migration /** * Create '_key_duration' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_duration'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_duration'); } catch (\Throwable $th) { Console::warning("'_key_duration' from {$id}: {$th->getMessage()}"); } @@ -751,16 +751,16 @@ class V15 extends Migration 'value' => (string) $value, 'search' => implode(' ', [$variableId, $key, $function->getId()]) ]); - $this->projectDB->createDocument('variables', $variable); + $this->dbForProject->createDocument('variables', $variable); } - $this->projectDB->deleteAttribute('functions', 'vars'); - $this->createAttributeFromCollection($this->projectDB, 'functions', 'vars'); + $this->dbForProject->deleteAttribute('functions', 'vars'); + $this->createAttributeFromCollection($this->dbForProject, 'functions', 'vars'); } try { /** * Create 'scheduleUpdatedAt' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'scheduleUpdatedAt'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'scheduleUpdatedAt'); } catch (\Throwable $th) { Console::warning("'scheduleUpdatedAt' from {$id}: {$th->getMessage()}"); } @@ -768,8 +768,8 @@ class V15 extends Migration /** * Create 'enabled' attribute */ - @$this->projectDB->deleteAttribute($id, 'status'); - $this->createAttributeFromCollection($this->projectDB, $id, 'enabled'); + @$this->dbForProject->deleteAttribute($id, 'status'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'enabled'); } catch (\Throwable $th) { Console::warning("'enabled' from {$id}: {$th->getMessage()}"); } @@ -777,7 +777,7 @@ class V15 extends Migration /** * Create '_key_name' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_name'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_name'); } catch (\Throwable $th) { Console::warning("'_key_name' from {$id}: {$th->getMessage()}"); } @@ -786,7 +786,7 @@ class V15 extends Migration /** * Create '_key_enabled' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_enabled'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_enabled'); } catch (\Throwable $th) { Console::warning("'_key_enabled' from {$id}: {$th->getMessage()}"); } @@ -795,7 +795,7 @@ class V15 extends Migration /** * Create '_key_runtime' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_runtime'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_runtime'); } catch (\Throwable $th) { Console::warning("'_key_runtime' from {$id}: {$th->getMessage()}"); } @@ -804,7 +804,7 @@ class V15 extends Migration /** * Create '_key_deployment' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_deployment'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_deployment'); } catch (\Throwable $th) { Console::warning("'_key_deployment' from {$id}: {$th->getMessage()}"); } @@ -813,7 +813,7 @@ class V15 extends Migration /** * Create '_key_schedule' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_schedule'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_schedule'); } catch (\Throwable $th) { Console::warning("'_key_schedule' from {$id}: {$th->getMessage()}"); } @@ -822,7 +822,7 @@ class V15 extends Migration /** * Create '_key_scheduleNext' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_scheduleNext'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_scheduleNext'); } catch (\Throwable $th) { Console::warning("'_key_scheduleNext' from {$id}: {$th->getMessage()}"); } @@ -831,7 +831,7 @@ class V15 extends Migration /** * Create '_key_schedulePrevious' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_schedulePrevious'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_schedulePrevious'); } catch (\Throwable $th) { Console::warning("'_key_schedulePrevious' from {$id}: {$th->getMessage()}"); } @@ -840,7 +840,7 @@ class V15 extends Migration /** * Create '_key_timeout' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_timeout'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_timeout'); } catch (\Throwable $th) { Console::warning("'_key_timeout' from {$id}: {$th->getMessage()}"); } @@ -863,7 +863,7 @@ class V15 extends Migration /** * Update 'expire' default value */ - $this->projectDB->updateAttributeDefault('keys', 'expire', null); + $this->dbForProject->updateAttributeDefault('keys', 'expire', null); } catch (\Throwable $th) { Console::warning("'expire' from {$id}: {$th->getMessage()}"); } @@ -871,7 +871,7 @@ class V15 extends Migration /** * Create 'accessedAt' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'accessedAt'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'accessedAt'); } catch (\Throwable $th) { Console::warning("'accessedAt' from {$id}: {$th->getMessage()}"); } @@ -880,7 +880,7 @@ class V15 extends Migration /** * Create 'sdks' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'sdks'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'sdks'); } catch (\Throwable $th) { Console::warning("'sdks' from {$id}: {$th->getMessage()}"); } @@ -889,7 +889,7 @@ class V15 extends Migration /** * Create '_key_accessedAt' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_accessedAt'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_accessedAt'); } catch (\Throwable $th) { Console::warning("'_key_accessedAt' from {$id}: {$th->getMessage()}"); } @@ -907,7 +907,7 @@ class V15 extends Migration /** * Create '_key_userId' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_userId'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_userId'); } catch (\Throwable $th) { Console::warning("'_key_userId' from {$id}: {$th->getMessage()}"); } @@ -916,7 +916,7 @@ class V15 extends Migration /** * Create '_key_teamId' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_teamId'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_teamId'); } catch (\Throwable $th) { Console::warning("'_key_teamId' from {$id}: {$th->getMessage()}"); } @@ -925,7 +925,7 @@ class V15 extends Migration /** * Create '_key_invited' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_invited'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_invited'); } catch (\Throwable $th) { Console::warning("'_key_invited' from {$id}: {$th->getMessage()}"); } @@ -934,7 +934,7 @@ class V15 extends Migration /** * Create '_key_joined' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_joined'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_joined'); } catch (\Throwable $th) { Console::warning("'_key_joined' from {$id}: {$th->getMessage()}"); } @@ -943,7 +943,7 @@ class V15 extends Migration /** * Create '_key_confirm' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_confirm'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_confirm'); } catch (\Throwable $th) { Console::warning("'_key_confirm' from {$id}: {$th->getMessage()}"); } @@ -966,7 +966,7 @@ class V15 extends Migration /** * Create '_key_name' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_name'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_name'); } catch (\Throwable $th) { Console::warning("'_key_name' from {$id}: {$th->getMessage()}"); } @@ -1000,8 +1000,8 @@ class V15 extends Migration /** * Re-Create '_key_metric' index */ - @$this->projectDB->deleteIndex($id, '_key_metric'); - $this->createIndexFromCollection($this->projectDB, $id, '_key_period_time'); + @$this->dbForProject->deleteIndex($id, '_key_metric'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_period_time'); } catch (\Throwable $th) { Console::warning("'_key_period_time' from {$id}: {$th->getMessage()}"); } @@ -1010,8 +1010,8 @@ class V15 extends Migration /** * Re-Create '_key_metric_period' index */ - @$this->projectDB->deleteIndex($id, '_key_metric_period'); - $this->createIndexFromCollection($this->projectDB, $id, '_key_metric_period_time'); + @$this->dbForProject->deleteIndex($id, '_key_metric_period'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_metric_period_time'); } catch (\Throwable $th) { Console::warning("'_key_metric_period_time' from {$id}: {$th->getMessage()}"); } @@ -1027,7 +1027,7 @@ class V15 extends Migration /** * Create '_key_name' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_name'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_name'); } catch (\Throwable $th) { Console::warning("'_key_name' from {$id}: {$th->getMessage()}"); } @@ -1036,7 +1036,7 @@ class V15 extends Migration /** * Create '_key_total' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_total'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_total'); } catch (\Throwable $th) { Console::warning("'_key_total' from {$id}: {$th->getMessage()}"); } @@ -1062,7 +1062,7 @@ class V15 extends Migration /** * Create 'hash' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'hash'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'hash'); } catch (\Throwable $th) { Console::warning("'hash' from {$id}: {$th->getMessage()}"); } @@ -1071,7 +1071,7 @@ class V15 extends Migration /** * Create 'hashOptions' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'hashOptions'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'hashOptions'); } catch (\Throwable $th) { Console::warning("'hashOptions' from {$id}: {$th->getMessage()}"); } @@ -1124,14 +1124,14 @@ class V15 extends Migration */ $this->populatePermissionsAttribute($user, addCreatePermission: false); - $this->projectDB->updateDocument('users', $user->getId(), $user); + $this->dbForProject->updateDocument('users', $user->getId(), $user); } try { /** * Add datetime filter to password. */ - $this->projectDB->updateAttributeFilters($id, 'password', ['encrypt']); + $this->dbForProject->updateAttributeFilters($id, 'password', ['encrypt']); } catch (\Throwable $th) { Console::warning("Add 'encrypt' filter to 'password' from {$id}: {$th->getMessage()}"); } @@ -1140,7 +1140,7 @@ class V15 extends Migration /** * Create '_key_name' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_name'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_name'); } catch (\Throwable $th) { Console::warning("'_key_name' from {$id}: {$th->getMessage()}"); } @@ -1149,7 +1149,7 @@ class V15 extends Migration /** * Create '_key_status' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_status'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_status'); } catch (\Throwable $th) { Console::warning("'_key_status' from {$id}: {$th->getMessage()}"); } @@ -1158,7 +1158,7 @@ class V15 extends Migration /** * Create '_key_passwordUpdate' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_passwordUpdate'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_passwordUpdate'); } catch (\Throwable $th) { Console::warning("'_key_passwordUpdate' from {$id}: {$th->getMessage()}"); } @@ -1167,7 +1167,7 @@ class V15 extends Migration /** * Create '_key_registration' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_registration'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_registration'); } catch (\Throwable $th) { Console::warning("'_key_registration' from {$id}: {$th->getMessage()}"); } @@ -1176,7 +1176,7 @@ class V15 extends Migration /** * Create '_key_emailVerification' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_emailVerification'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_emailVerification'); } catch (\Throwable $th) { Console::warning("'_key_emailVerification' from {$id}: {$th->getMessage()}"); } @@ -1185,7 +1185,7 @@ class V15 extends Migration /** * Create '_key_phoneVerification' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_phoneVerification'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_phoneVerification'); } catch (\Throwable $th) { Console::warning("'_key_phoneVerification' from {$id}: {$th->getMessage()}"); } @@ -1470,9 +1470,9 @@ class V15 extends Migration $from = $this->pdo->quote($from); $to = $this->pdo->quote($to); - $this->pdo->prepare("UPDATE `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}_stats` SET metric = {$to} WHERE metric = {$from}")->execute(); + $this->pdo->prepare("UPDATE `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}_stats` SET metric = {$to} WHERE metric = {$from}")->execute(); } catch (\Throwable $th) { - Console::warning("Migrating steps from {$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}_stats:" . $th->getMessage()); + Console::warning("Migrating steps from {$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}_stats:" . $th->getMessage()); } } diff --git a/src/Appwrite/Migration/Version/V16.php b/src/Appwrite/Migration/Version/V16.php index 49f244598e..34407a0471 100644 --- a/src/Appwrite/Migration/Version/V16.php +++ b/src/Appwrite/Migration/Version/V16.php @@ -45,7 +45,7 @@ class V16 extends Migration Console::log("Migrating Collection \"{$id}\""); - $this->projectDB->setNamespace("_{$this->project->getInternalId()}"); + $this->dbForProject->setNamespace("_{$this->project->getInternalId()}"); switch ($id) { case 'sessions': @@ -53,7 +53,7 @@ class V16 extends Migration /** * Create 'expire' attribute */ - $this->projectDB->deleteAttribute($id, 'expire'); + $this->dbForProject->deleteAttribute($id, 'expire'); } catch (\Throwable $th) { Console::warning("'expire' from {$id}: {$th->getMessage()}"); } @@ -65,7 +65,7 @@ class V16 extends Migration /** * Create 'region' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'region'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'region'); } catch (\Throwable $th) { Console::warning("'region' from {$id}: {$th->getMessage()}"); } @@ -74,7 +74,7 @@ class V16 extends Migration /** * Create '_key_team' index */ - $this->createIndexFromCollection($this->projectDB, $id, '_key_team'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_team'); } catch (\Throwable $th) { Console::warning("'_key_team' from {$id}: {$th->getMessage()}"); } @@ -85,7 +85,7 @@ class V16 extends Migration /** * Create 'region' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'region'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'region'); } catch (\Throwable $th) { Console::warning("'region' from {$id}: {$th->getMessage()}"); } diff --git a/src/Appwrite/Migration/Version/V17.php b/src/Appwrite/Migration/Version/V17.php index 96c890c65d..f7cb08d6f4 100644 --- a/src/Appwrite/Migration/Version/V17.php +++ b/src/Appwrite/Migration/Version/V17.php @@ -47,8 +47,8 @@ class V17 extends Migration $id = "bucket_{$bucket->getInternalId()}"; try { - $this->projectDB->updateAttribute($id, 'mimeType', Database::VAR_STRING, 255, true, false); - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->updateAttribute($id, 'mimeType', Database::VAR_STRING, 255, true, false); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'mimeType' from {$id}: {$th->getMessage()}"); } @@ -67,7 +67,7 @@ class V17 extends Migration Console::log("Migrating Collection \"{$id}\""); - $this->projectDB->setNamespace("_{$this->project->getInternalId()}"); + $this->dbForProject->setNamespace("_{$this->project->getInternalId()}"); switch ($id) { case 'builds': @@ -75,8 +75,8 @@ class V17 extends Migration /** * Create 'size' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'size'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'size'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'size' from {$id}: {$th->getMessage()}"); } @@ -87,8 +87,8 @@ class V17 extends Migration /** * Update 'mimeType' attribute size (127->255) */ - $this->projectDB->updateAttribute($id, 'mimeType', Database::VAR_STRING, 255, true, false); - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->updateAttribute($id, 'mimeType', Database::VAR_STRING, 255, true, false); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'mimeType' from {$id}: {$th->getMessage()}"); } @@ -97,8 +97,8 @@ class V17 extends Migration /** * Create 'bucketInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'bucketInternalId'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'bucketInternalId'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'deploymentInternalId' from {$id}: {$th->getMessage()}"); } @@ -109,8 +109,8 @@ class V17 extends Migration /** * Delete 'endTime' attribute (use startTime+duration if needed) */ - $this->projectDB->deleteAttribute($id, 'endTime'); - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->deleteAttribute($id, 'endTime'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'endTime' from {$id}: {$th->getMessage()}"); } @@ -119,8 +119,8 @@ class V17 extends Migration /** * Rename 'outputPath' to 'path' */ - $this->projectDB->renameAttribute($id, 'outputPath', 'path'); - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->renameAttribute($id, 'outputPath', 'path'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'path' from {$id}: {$th->getMessage()}"); } @@ -129,8 +129,8 @@ class V17 extends Migration /** * Create 'deploymentInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'deploymentInternalId'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'deploymentInternalId'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'deploymentInternalId' from {$id}: {$th->getMessage()}"); } @@ -141,8 +141,8 @@ class V17 extends Migration /** * Delete 'type' attribute */ - $this->projectDB->deleteAttribute($id, 'type'); - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->deleteAttribute($id, 'type'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'type' from {$id}: {$th->getMessage()}"); } @@ -153,8 +153,8 @@ class V17 extends Migration /** * Create 'resourceInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'resourceInternalId'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'resourceInternalId'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'resourceInternalId' from {$id}: {$th->getMessage()}"); } @@ -165,8 +165,8 @@ class V17 extends Migration /** * Create 'deploymentInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'deploymentInternalId'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'deploymentInternalId'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'deploymentInternalId' from {$id}: {$th->getMessage()}"); } @@ -175,8 +175,8 @@ class V17 extends Migration /** * Create 'scheduleInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'scheduleInternalId'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'scheduleInternalId'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'scheduleInternalId' from {$id}: {$th->getMessage()}"); } @@ -185,8 +185,8 @@ class V17 extends Migration /** * Delete 'scheduleUpdatedAt' attribute */ - $this->projectDB->deleteAttribute($id, 'scheduleUpdatedAt'); - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->deleteAttribute($id, 'scheduleUpdatedAt'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'scheduleUpdatedAt' from {$id}: {$th->getMessage()}"); } @@ -197,8 +197,8 @@ class V17 extends Migration /** * Create 'resourceInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'resourceInternalId'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'resourceInternalId'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'resourceInternalId' from {$id}: {$th->getMessage()}"); } @@ -207,8 +207,8 @@ class V17 extends Migration /** * Create 'buildInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'buildInternalId'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'buildInternalId'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'buildInternalId' from {$id}: {$th->getMessage()}"); } @@ -219,8 +219,8 @@ class V17 extends Migration /** * Create 'functionInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'functionInternalId'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'functionInternalId'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'functionInternalId' from {$id}: {$th->getMessage()}"); } @@ -229,8 +229,8 @@ class V17 extends Migration /** * Create 'deploymentInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'deploymentInternalId'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'deploymentInternalId'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'deploymentInternalId' from {$id}: {$th->getMessage()}"); } diff --git a/src/Appwrite/Migration/Version/V18.php b/src/Appwrite/Migration/Version/V18.php index ac4093aaca..a5fae3789b 100644 --- a/src/Appwrite/Migration/Version/V18.php +++ b/src/Appwrite/Migration/Version/V18.php @@ -26,7 +26,7 @@ class V18 extends Migration } Console::log('Migrating Project: ' . $this->project->getAttribute('name') . ' (' . $this->project->getId() . ')'); - $this->projectDB->setNamespace("_{$this->project->getInternalId()}"); + $this->dbForProject->setNamespace("_{$this->project->getInternalId()}"); $this->addDocumentSecurityToProject(); Console::info('Migrating Databases'); @@ -66,7 +66,7 @@ class V18 extends Migration $documentSecurity = $collection->getAttribute('documentSecurity', false); $permissions = $collection->getPermissions(); - $this->projectDB->updateCollection($collectionTable, $permissions, $documentSecurity); + $this->dbForProject->updateCollection($collectionTable, $permissions, $documentSecurity); } catch (\Throwable $th) { Console::warning($th->getMessage()); } @@ -94,7 +94,7 @@ class V18 extends Migration } try { - $this->projectDB->updateCollection($id, [Permission::create(Role::any())], true); + $this->dbForProject->updateCollection($id, [Permission::create(Role::any())], true); } catch (\Throwable $th) { Console::warning($th->getMessage()); } @@ -105,8 +105,8 @@ class V18 extends Migration /** * Create 'passwordHistory' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'passwordHistory'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'passwordHistory'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'passwordHistory' from {$id}: {$th->getMessage()}"); } @@ -116,8 +116,8 @@ class V18 extends Migration /** * Create 'prefs' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'prefs'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'prefs'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'prefs' from {$id}: {$th->getMessage()}"); } @@ -127,8 +127,8 @@ class V18 extends Migration /** * Create 'options' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'options'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'options'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'options' from {$id}: {$th->getMessage()}"); } @@ -138,7 +138,7 @@ class V18 extends Migration /** * Delete 'userInternalId' attribute */ - $this->projectDB->deleteAttribute($id, 'userInternalId'); + $this->dbForProject->deleteAttribute($id, 'userInternalId'); } catch (\Throwable $th) { Console::warning("'userInternalId' from {$id}: {$th->getMessage()}"); } @@ -200,7 +200,7 @@ class V18 extends Migration $internalBucketId = "bucket_{$this->project->getInternalId()}"; $permissions = $document->getPermissions(); $fileSecurity = $document->getAttribute('fileSecurity', false); - $this->projectDB->updateCollection($internalBucketId, $permissions, $fileSecurity); + $this->dbForProject->updateCollection($internalBucketId, $permissions, $fileSecurity); } catch (\Throwable $th) { Console::warning($th->getMessage()); } @@ -214,8 +214,8 @@ class V18 extends Migration $data = $document->getAttribute('data', []); $mode = $data['mode'] ?? 'default'; $user = match ($mode) { - 'admin' => $this->consoleDB->getDocument('users', $userId), - default => $this->projectDB->getDocument('users', $userId), + 'admin' => $this->dbForPlatform->getDocument('users', $userId), + default => $this->dbForProject->getDocument('users', $userId), }; if ($user->isEmpty()) { @@ -244,7 +244,7 @@ class V18 extends Migration /** * Create 'documentSecurity' column */ - $this->pdo->prepare("ALTER TABLE `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}__metadata` ADD COLUMN IF NOT EXISTS documentSecurity TINYINT(1);")->execute(); + $this->pdo->prepare("ALTER TABLE `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}__metadata` ADD COLUMN IF NOT EXISTS documentSecurity TINYINT(1);")->execute(); } catch (\Throwable $th) { Console::warning($th->getMessage()); } @@ -253,7 +253,7 @@ class V18 extends Migration /** * Set 'documentSecurity' column to 1 if NULL */ - $this->pdo->prepare("UPDATE `{$this->projectDB->getDatabase()}`.`_{$this->project->getInternalId()}__metadata` SET documentSecurity = 1 WHERE documentSecurity IS NULL")->execute(); + $this->pdo->prepare("UPDATE `{$this->dbForProject->getDatabase()}`.`_{$this->project->getInternalId()}__metadata` SET documentSecurity = 1 WHERE documentSecurity IS NULL")->execute(); } catch (\Throwable $th) { Console::warning($th->getMessage()); } diff --git a/src/Appwrite/Migration/Version/V19.php b/src/Appwrite/Migration/Version/V19.php index 4415003bfd..cae27cc6ed 100644 --- a/src/Appwrite/Migration/Version/V19.php +++ b/src/Appwrite/Migration/Version/V19.php @@ -28,7 +28,7 @@ class V19 extends Migration } Console::log('Migrating Project: ' . $this->project->getAttribute('name') . ' (' . $this->project->getId() . ')'); - $this->projectDB->setNamespace("_{$this->project->getInternalId()}"); + $this->dbForProject->setNamespace("_{$this->project->getInternalId()}"); Console::info('Migrating Collections'); $this->migrateCollections(); @@ -55,7 +55,7 @@ class V19 extends Migration protected function migrateDomains(): void { - if ($this->consoleDB->exists($this->consoleDB->getDatabase(), 'domains')) { + if ($this->dbForPlatform->exists($this->dbForPlatform->getDatabase(), 'domains')) { foreach ($this->documentsIterator('domains') as $domain) { $status = 'created'; if ($domain->getAttribute('verification', false)) { @@ -82,7 +82,7 @@ class V19 extends Migration ]); try { - $this->consoleDB->createDocument('rules', $ruleDocument); + $this->dbForPlatform->createDocument('rules', $ruleDocument); } catch (\Throwable $th) { Console::warning("Error migrating domain {$domain->getAttribute('domain')}: {$th->getMessage()}"); } @@ -104,8 +104,8 @@ class V19 extends Migration Console::log("Migrating Bucket {$id} {$bucket->getId()} ({$bucket->getAttribute('name')})"); try { - $this->createAttributeFromCollection($this->projectDB, $id, 'bucketInternalId', 'files'); - $this->projectDB->purgeCachedCollection($id); + $this->createAttributeFromCollection($this->dbForProject, $id, 'bucketInternalId', 'files'); + $this->dbForProject->purgeCachedCollection($id); } catch (\Throwable $th) { Console::warning("'bucketInternalId' from {$id}: {$th->getMessage()}"); } @@ -136,7 +136,7 @@ class V19 extends Migration Console::log("Migrating Collection \"{$id}\""); - $this->projectDB->setNamespace("_$internalProjectId"); + $this->dbForProject->setNamespace("_$internalProjectId"); switch ($id) { case '_metadata': @@ -148,24 +148,24 @@ class V19 extends Migration case 'attributes': case 'indexes': try { - $this->projectDB->updateAttribute($id, 'databaseInternalId', required: true); + $this->dbForProject->updateAttribute($id, 'databaseInternalId', required: true); } catch (\Throwable $th) { Console::warning("'databaseInternalId' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->updateAttribute($id, 'collectionInternalId', required: true); + $this->dbForProject->updateAttribute($id, 'collectionInternalId', required: true); } catch (\Throwable $th) { Console::warning("'collectionInternalId' from {$id}: {$th->getMessage()}"); } try { - $this->createAttributeFromCollection($this->projectDB, $id, 'error'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'error'); } catch (\Throwable $th) { Console::warning("'error' from {$id}: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'buckets': @@ -175,7 +175,7 @@ class V19 extends Migration ]; foreach ($indexesToDelete as $index) { try { - $this->projectDB->deleteIndex($id, $index); + $this->dbForProject->deleteIndex($id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } @@ -187,13 +187,13 @@ class V19 extends Migration foreach ($indexesToCreate as $index) { try { - $this->createIndexFromCollection($this->projectDB, $id, $index); + $this->createIndexFromCollection($this->dbForProject, $id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'builds': @@ -204,45 +204,45 @@ class V19 extends Migration ]; foreach ($attributesToCreate as $attribute) { try { - $this->createAttributeFromCollection($this->projectDB, $id, $attribute); + $this->createAttributeFromCollection($this->dbForProject, $id, $attribute); } catch (\Throwable $th) { Console::warning("$attribute from {$id}: {$th->getMessage()}"); } } try { - $this->projectDB->renameAttribute($id, 'outputPath', 'path'); + $this->dbForProject->renameAttribute($id, 'outputPath', 'path'); } catch (\Throwable $th) { Console::warning("'path' from {$id}: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'certificates': try { - $this->projectDB->renameAttribute($id, 'log', 'logs'); + $this->dbForProject->renameAttribute($id, 'log', 'logs'); } catch (\Throwable $th) { Console::warning("'logs' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->updateAttribute($id, 'logs', size: 1000000); + $this->dbForProject->updateAttribute($id, 'logs', size: 1000000); } catch (\Throwable $th) { Console::warning("'logs' from {$id}: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'databases': try { - $this->createAttributeFromCollection($this->projectDB, $id, 'enabled'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'enabled'); } catch (\Throwable $th) { Console::warning("'enabled' from {$id}: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'deployments': @@ -271,7 +271,7 @@ class V19 extends Migration ]; foreach ($attributesToCreate as $attribute) { try { - $this->createAttributeFromCollection($this->projectDB, $id, $attribute); + $this->createAttributeFromCollection($this->dbForProject, $id, $attribute); } catch (\Throwable $th) { Console::warning("$attribute from {$id}: {$th->getMessage()}"); } @@ -286,7 +286,7 @@ class V19 extends Migration ]; foreach ($indexesToDelete as $index) { try { - $this->projectDB->deleteIndex($id, $index); + $this->dbForProject->deleteIndex($id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } @@ -299,13 +299,13 @@ class V19 extends Migration ]; foreach ($indexesToCreate as $index) { try { - $this->createIndexFromCollection($this->projectDB, $id, $index); + $this->createIndexFromCollection($this->dbForProject, $id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'executions': @@ -319,7 +319,7 @@ class V19 extends Migration ]; foreach ($attributesToCreate as $attribute) { try { - $this->createAttributeFromCollection($this->projectDB, $id, $attribute); + $this->createAttributeFromCollection($this->dbForProject, $id, $attribute); } catch (\Throwable $th) { Console::warning("$attribute from {$id}: {$th->getMessage()}"); } @@ -330,43 +330,43 @@ class V19 extends Migration ]; foreach ($attributesToDelete as $attribute) { try { - $this->projectDB->deleteAttribute($id, $attribute); + $this->dbForProject->deleteAttribute($id, $attribute); } catch (\Throwable $th) { Console::warning("'$attribute' from {$id}: {$th->getMessage()}"); } } try { - $this->projectDB->renameAttribute($id, 'stderr', 'errors'); + $this->dbForProject->renameAttribute($id, 'stderr', 'errors'); } catch (\Throwable $th) { Console::warning("'errors' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->renameAttribute($id, 'stdout', 'logs'); + $this->dbForProject->renameAttribute($id, 'stdout', 'logs'); } catch (\Throwable $th) { Console::warning("'logs' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->renameAttribute($id, 'statusCode', 'responseStatusCode'); + $this->dbForProject->renameAttribute($id, 'statusCode', 'responseStatusCode'); } catch (\Throwable $th) { Console::warning("'responseStatusCode' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->deleteIndex($id, '_key_statusCode'); + $this->dbForProject->deleteIndex($id, '_key_statusCode'); } catch (\Throwable $th) { Console::warning("'_key_statusCode' from {$id}: {$th->getMessage()}"); } try { - $this->createIndexFromCollection($this->projectDB, $id, '_key_responseStatusCode'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_responseStatusCode'); } catch (\Throwable $th) { Console::warning("'_key_responseStatusCode' from {$id}: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'files': @@ -378,7 +378,7 @@ class V19 extends Migration ]; foreach ($indexesToDelete as $index) { try { - $this->projectDB->deleteIndex($id, $index); + $this->dbForProject->deleteIndex($id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } @@ -387,13 +387,13 @@ class V19 extends Migration $indexesToCreate = $indexesToDelete; foreach ($indexesToCreate as $index) { try { - $this->createIndexFromCollection($this->projectDB, $id, $index); + $this->createIndexFromCollection($this->dbForProject, $id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'functions': @@ -419,7 +419,7 @@ class V19 extends Migration ]; foreach ($attributesToCreate as $attribute) { try { - $this->createAttributeFromCollection($this->projectDB, $id, $attribute); + $this->createAttributeFromCollection($this->dbForProject, $id, $attribute); } catch (\Throwable $th) { Console::warning("'$attribute' from {$id}: {$th->getMessage()}"); } @@ -433,7 +433,7 @@ class V19 extends Migration ]; foreach ($indexesToDelete as $index) { try { - $this->projectDB->deleteIndex($id, $index); + $this->dbForProject->deleteIndex($id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } @@ -449,34 +449,34 @@ class V19 extends Migration ]; foreach ($indexesToCreate as $index) { try { - $this->createIndexFromCollection($this->projectDB, $id, $index); + $this->createIndexFromCollection($this->dbForProject, $id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'memberships': try { - $this->projectDB->updateAttribute($id, 'teamInternalId', required: true); + $this->dbForProject->updateAttribute($id, 'teamInternalId', required: true); } catch (\Throwable $th) { Console::warning("'teamInternalId' from {$id}: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); // Intentional fall through to update memberships.userInternalId case 'sessions': case 'tokens': try { - $this->projectDB->updateAttribute($id, 'userInternalId', required: true); + $this->dbForProject->updateAttribute($id, 'userInternalId', required: true); } catch (\Throwable $th) { Console::warning("'userInternalId' from {$id}: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'domains': @@ -484,12 +484,12 @@ class V19 extends Migration case 'platforms': case 'webhooks': try { - $this->projectDB->updateAttribute($id, 'projectInternalId', required: true); + $this->dbForProject->updateAttribute($id, 'projectInternalId', required: true); } catch (\Throwable $th) { Console::warning("'projectInternalId' from {$id}: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'projects': @@ -500,19 +500,19 @@ class V19 extends Migration ]; foreach ($attributesToCreate as $attribute) { try { - $this->createAttributeFromCollection($this->projectDB, $id, $attribute); + $this->createAttributeFromCollection($this->dbForProject, $id, $attribute); } catch (\Throwable $th) { Console::warning("'$attribute' from {$id}: {$th->getMessage()}"); Console::warning($th->getTraceAsString()); } } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'stats': try { - $this->projectDB->updateAttribute($id, 'value', signed: true); + $this->dbForProject->updateAttribute($id, 'value', signed: true); } catch (\Throwable $th) { Console::warning("'value' from {$id}: {$th->getMessage()}"); } @@ -539,64 +539,64 @@ class V19 extends Migration // Console::warning("'_key_metric_period_time' from {$id}: {$th->getMessage()}"); // } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'users': try { - $this->createAttributeFromCollection($this->projectDB, $id, 'labels'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'labels'); } catch (\Throwable $th) { Console::warning("'labels' from {$id}: {$th->getMessage()}"); } try { - $this->createAttributeFromCollection($this->projectDB, $id, 'accessedAt'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'accessedAt'); } catch (\Throwable $th) { Console::warning("'accessedAt' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->updateAttribute($id, 'search', filters: ['userSearch']); + $this->dbForProject->updateAttribute($id, 'search', filters: ['userSearch']); } catch (\Throwable $th) { Console::warning("'search' from {$id}: {$th->getMessage()}"); } try { - $this->createIndexFromCollection($this->projectDB, $id, '_key_accessedAt'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_accessedAt'); } catch (\Throwable $th) { Console::warning("'_key_accessedAt' from {$id}: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; case 'variables': try { - $this->projectDB->deleteIndex($id, '_key_function'); + $this->dbForProject->deleteIndex($id, '_key_function'); } catch (\Throwable $th) { Console::warning("'_key_function' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->deleteIndex($id, '_key_uniqueKey'); + $this->dbForProject->deleteIndex($id, '_key_uniqueKey'); } catch (\Throwable $th) { Console::warning("'_key_uniqueKey' from {$id}: {$th->getMessage()}"); } try { - $this->createAttributeFromCollection($this->projectDB, $id, 'resourceType'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'resourceType'); } catch (\Throwable $th) { Console::warning("'resourceType' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->renameAttribute($id, 'functionInternalId', 'resourceInternalId'); + $this->dbForProject->renameAttribute($id, 'functionInternalId', 'resourceInternalId'); } catch (\Throwable $th) { Console::warning("'resourceInternalId' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->renameAttribute($id, 'functionId', 'resourceId'); + $this->dbForProject->renameAttribute($id, 'functionId', 'resourceId'); } catch (\Throwable $th) { Console::warning("'resourceId' from {$id}: {$th->getMessage()}"); } @@ -609,13 +609,13 @@ class V19 extends Migration ]; foreach ($indexesToCreate as $index) { try { - $this->createIndexFromCollection($this->projectDB, $id, $index); + $this->createIndexFromCollection($this->dbForProject, $id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } } - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); break; default: @@ -654,10 +654,10 @@ class V19 extends Migration ]) as $attribute ) { $attribute->setAttribute('size', Database::LENGTH_KEY); - $this->projectDB->updateDocument('attributes', $attribute->getId(), $attribute); + $this->dbForProject->updateDocument('attributes', $attribute->getId(), $attribute); $databaseInternalId = $attribute->getAttribute('databaseInternalId'); $collectionInternalId = $attribute->getAttribute('collectionInternalId'); - $this->projectDB->updateAttribute('database_' . $databaseInternalId . '_collection_' . $collectionInternalId, $attribute->getAttribute('key'), size: 255); + $this->dbForProject->updateAttribute('database_' . $databaseInternalId . '_collection_' . $collectionInternalId, $attribute->getAttribute('key'), size: 255); } } @@ -679,7 +679,7 @@ class V19 extends Migration break; case 'builds': $deploymentId = $document->getAttribute('deploymentId'); - $deployment = $this->projectDB->getDocument('deployments', $deploymentId); + $deployment = $this->dbForProject->getDocument('deployments', $deploymentId); $document->setAttribute('deploymentInternalId', $deployment->getInternalId()); $stdout = $document->getAttribute('stdout', ''); @@ -691,12 +691,12 @@ class V19 extends Migration break; case 'deployments': $resourceId = $document->getAttribute('resourceId'); - $function = $this->projectDB->getDocument('functions', $resourceId); + $function = $this->dbForProject->getDocument('functions', $resourceId); $document->setAttribute('resourceInternalId', $function->getInternalId()); $buildId = $document->getAttribute('buildId'); if (!empty($buildId)) { - $build = $this->projectDB->getDocument('builds', $buildId); + $build = $this->dbForProject->getDocument('builds', $buildId); $document->setAttribute('buildInternalId', $build->getInternalId()); } @@ -706,11 +706,11 @@ class V19 extends Migration break; case 'executions': $functionId = $document->getAttribute('functionId'); - $function = $this->projectDB->getDocument('functions', $functionId); + $function = $this->dbForProject->getDocument('functions', $functionId); $document->setAttribute('functionInternalId', $function->getInternalId()); $deploymentId = $document->getAttribute('deploymentId'); - $deployment = $this->projectDB->getDocument('deployments', $deploymentId); + $deployment = $this->dbForProject->getDocument('deployments', $deploymentId); $document->setAttribute('deploymentInternalId', $deployment->getInternalId()); break; case 'functions': @@ -720,7 +720,7 @@ class V19 extends Migration $deploymentId = $document->getAttribute('deployment'); if (!empty($deploymentId)) { - $deployment = $this->projectDB->getDocument('deployments', $deploymentId); + $deployment = $this->dbForProject->getDocument('deployments', $deploymentId); $document->setAttribute('deploymentInternalId', $deployment->getInternalId()); $document->setAttribute('entrypoint', $deployment->getAttribute('entrypoint')); } @@ -729,7 +729,7 @@ class V19 extends Migration $document->setAttribute('commands', $document->getAttribute('commands', $commands)); if (empty($document->getAttribute('scheduleId', null))) { - $schedule = $this->consoleDB->createDocument('schedules', new Document([ + $schedule = $this->dbForPlatform->createDocument('schedules', new Document([ 'region' => $project->getAttribute('region'), 'resourceType' => 'function', 'resourceId' => $document->getId(), @@ -769,26 +769,26 @@ class V19 extends Migration private function cleanCollections(): void { try { - $this->projectDB->deleteAttribute('projects', 'domains'); + $this->dbForProject->deleteAttribute('projects', 'domains'); } catch (\Throwable $th) { Console::warning("'domains' from projects: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection('projects'); + $this->dbForProject->purgeCachedCollection('projects'); try { - $this->projectDB->deleteAttribute('builds', 'stderr'); + $this->dbForProject->deleteAttribute('builds', 'stderr'); } catch (\Throwable $th) { Console::warning("'stderr' from builds: {$th->getMessage()}"); } try { - $this->projectDB->deleteAttribute('builds', 'stdout'); + $this->dbForProject->deleteAttribute('builds', 'stdout'); } catch (\Throwable $th) { Console::warning("'stdout' from builds: {$th->getMessage()}"); } - $this->projectDB->purgeCachedCollection('builds'); + $this->dbForProject->purgeCachedCollection('builds'); } /** @@ -829,7 +829,7 @@ class V19 extends Migration } try { - $this->projectDB->updateDocument($document->getCollection(), $document->getId(), $document); + $this->dbForProject->updateDocument($document->getCollection(), $document->getId(), $document); } catch (\Throwable $th) { Console::error('Failed to update document: ' . $th->getMessage()); return; diff --git a/src/Appwrite/Migration/Version/V20.php b/src/Appwrite/Migration/Version/V20.php index 5a0807cedf..3a9bba6772 100644 --- a/src/Appwrite/Migration/Version/V20.php +++ b/src/Appwrite/Migration/Version/V20.php @@ -36,7 +36,7 @@ class V20 extends Migration } Console::log('Migrating Project: ' . $this->project->getAttribute('name') . ' (' . $this->project->getId() . ')'); - $this->projectDB->setNamespace("_{$this->project->getInternalId()}"); + $this->dbForProject->setNamespace("_{$this->project->getInternalId()}"); Console::info('Migrating Collections'); $this->migrateCollections(); @@ -94,19 +94,19 @@ class V20 extends Migration ) { if (\in_array($attribute->getAttribute('key'), $index->getAttribute('attributes'))) { try { - $this->projectDB->deleteIndex($collectionId, $index->getAttribute('key')); + $this->dbForProject->deleteIndex($collectionId, $index->getAttribute('key')); } catch (Throwable $th) { Console::warning("Failed to delete index: {$th->getMessage()}"); } try { - $this->projectDB->deleteDocument('indexes', $index->getId()); + $this->dbForProject->deleteDocument('indexes', $index->getId()); } catch (Throwable $th) { Console::warning("Failed to remove index: {$th->getMessage()}"); } } } - $this->projectDB->updateAttribute($collectionId, $attribute['key'], $attribute['type']); + $this->dbForProject->updateAttribute($collectionId, $attribute['key'], $attribute['type']); } } @@ -116,19 +116,19 @@ class V20 extends Migration Console::log("Migrating Collection \"{$id}\""); - $this->projectDB->setNamespace("_$internalProjectId"); + $this->dbForProject->setNamespace("_$internalProjectId"); // Support database array type migration foreach ($collection['attributes'] ?? [] as $attribute) { if ($attribute['array'] === true) { foreach ($collection['indexes'] ?? [] as $index) { if (\in_array($attribute['$id'], $index['attributes'])) { - $this->projectDB->deleteIndex($id, $index['$id']); + $this->dbForProject->deleteIndex($id, $index['$id']); } } try { - $this->projectDB->updateAttribute($id, $attribute['$id'], $attribute['type']); + $this->dbForProject->updateAttribute($id, $attribute['$id'], $attribute['type']); } catch (Throwable $th) { Console::warning("'{$attribute['$id']}' from {$id}: {$th->getMessage()}"); } @@ -151,19 +151,19 @@ class V20 extends Migration // Create resourceType attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'resourceType'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'resourceType'); } catch (Throwable $th) { Console::warning("'resourceType' from {$id}: {$th->getMessage()}"); } // Create mimeType attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'mimeType'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'mimeType'); } catch (Throwable $th) { Console::warning("'mimeType' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); } catch (Throwable $th) { Console::warning("Purge cache from {$id}: {$th->getMessage()}"); } @@ -174,11 +174,11 @@ class V20 extends Migration /** * Delete 'type' attribute */ - $this->projectDB->deleteAttribute($id, 'type'); + $this->dbForProject->deleteAttribute($id, 'type'); /** * Alter `signed` internal type on `value` attr */ - $this->projectDB->updateAttribute(collection: $id, id: 'value', signed: true); + $this->dbForProject->updateAttribute(collection: $id, id: 'value', signed: true); } catch (Throwable $th) { Console::warning("'type' from {$id}: {$th->getMessage()}"); } @@ -187,13 +187,13 @@ class V20 extends Migration /** * Ensure 'time' attribute is not required */ - $this->projectDB->updateAttribute($id, 'time', required: false); + $this->dbForProject->updateAttribute($id, 'time', required: false); } catch (Throwable $th) { Console::warning("'time' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); } catch (Throwable $th) { Console::warning("Purge cache from {$id}: {$th->getMessage()}"); } @@ -202,13 +202,13 @@ class V20 extends Migration $index = '_key_metric_period_time'; try { - $this->projectDB->deleteIndex($id, $index); + $this->dbForProject->deleteIndex($id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } try { - $this->createIndexFromCollection($this->projectDB, $id, $index); + $this->createIndexFromCollection($this->dbForProject, $id, $index); } catch (\Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } @@ -217,27 +217,27 @@ class V20 extends Migration case 'sessions': // Create expire attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'expire'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'expire'); } catch (Throwable $th) { Console::warning("'expire' from {$id}: {$th->getMessage()}"); } // Create factors attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'factors'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'factors'); } catch (Throwable $th) { Console::warning("'factors' from {$id}: {$th->getMessage()}"); } // Create mfaRecoveryCodes attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'mfaUpdatedAt'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'mfaUpdatedAt'); } catch (Throwable $th) { Console::warning("'mfaUpdatedAt' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); } catch (Throwable $th) { Console::warning("Purge cache from {$id}: {$th->getMessage()}"); } @@ -246,41 +246,41 @@ class V20 extends Migration case 'users': // Create targets attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'targets'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'targets'); } catch (Throwable $th) { Console::warning("'targets' from {$id}: {$th->getMessage()}"); } // Create mfa attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'mfa'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'mfa'); } catch (Throwable $th) { Console::warning("'mfa' from {$id}: {$th->getMessage()}"); } // Create mfaRecoveryCodes attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'mfaRecoveryCodes'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'mfaRecoveryCodes'); } catch (Throwable $th) { Console::warning("'mfaRecoveryCodes' from {$id}: {$th->getMessage()}"); } // Create challenges attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'challenges'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'challenges'); } catch (Throwable $th) { Console::warning("'challenges' from {$id}: {$th->getMessage()}"); } // Create authenticators attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'authenticators'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'authenticators'); } catch (Throwable $th) { Console::warning("'authenticators' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); } catch (Throwable $th) { Console::warning("Purge cache from {$id}: {$th->getMessage()}"); } @@ -289,20 +289,20 @@ class V20 extends Migration case 'projects': // Rename providers authProviders to oAuthProviders try { - $this->projectDB->renameAttribute($id, 'authProviders', 'oAuthProviders'); + $this->dbForProject->renameAttribute($id, 'authProviders', 'oAuthProviders'); } catch (Throwable $th) { Console::warning("'oAuthProviders' from {$id}: {$th->getMessage()}"); } // Create apis attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'apis'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'apis'); } catch (Throwable $th) { Console::warning("'apis' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); } catch (Throwable $th) { Console::warning("Purge cache from {$id}: {$th->getMessage()}"); } @@ -311,27 +311,27 @@ class V20 extends Migration case 'webhooks': // Create enabled attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'enabled'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'enabled'); } catch (Throwable $th) { Console::warning("'enabled' from {$id}: {$th->getMessage()}"); } // Create logs attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'logs'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'logs'); } catch (Throwable $th) { Console::warning("'logs' from {$id}: {$th->getMessage()}"); } // Create attempts attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'attempts'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'attempts'); } catch (Throwable $th) { Console::warning("'attempts' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); } catch (Throwable $th) { Console::warning("Purge cache from {$id}: {$th->getMessage()}"); } @@ -339,25 +339,25 @@ class V20 extends Migration break; case 'topics': try { - $this->projectDB->updateAttributeDefault($id, 'emailTotal', 0); + $this->dbForProject->updateAttributeDefault($id, 'emailTotal', 0); } catch (Throwable $th) { Console::warning("'topics' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->updateAttributeDefault($id, 'pushTotal', 0); + $this->dbForProject->updateAttributeDefault($id, 'pushTotal', 0); } catch (Throwable $th) { Console::warning("'topics' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->updateAttributeDefault($id, 'smsTotal', 0); + $this->dbForProject->updateAttributeDefault($id, 'smsTotal', 0); } catch (Throwable $th) { Console::warning("'topics' from {$id}: {$th->getMessage()}"); } try { - $this->projectDB->purgeCachedCollection($id); + $this->dbForProject->purgeCachedCollection($id); } catch (Throwable $th) { Console::warning("Purge cache from {$id}: {$th->getMessage()}"); } @@ -382,7 +382,7 @@ class V20 extends Migration */ Console::info('Migrating Sessions metric'); - $sessionsCreated = $this->projectDB->sum('stats', 'value', [ + $sessionsCreated = $this->dbForProject->sum('stats', 'value', [ Query::equal('metric', [ 'sessions.email-password.requests.create', 'sessions.magic-url.requests.create', @@ -394,7 +394,7 @@ class V20 extends Migration Query::equal('period', ['1d']), ]); - $query = $this->projectDB->findOne('stats', [ + $query = $this->dbForProject->findOne('stats', [ Query::equal('metric', ['sessions.$all.requests.delete']), Query::equal('period', ['1d']), ]); @@ -420,7 +420,7 @@ class V20 extends Migration */ Console::log("Creating inf metric to {$metric}"); $id = \md5("_inf_{$metric}"); - $this->projectDB->createDocument('stats', new Document([ + $this->dbForProject->createDocument('stats', new Document([ '$id' => $id, 'metric' => $metric, 'period' => 'inf', @@ -448,7 +448,7 @@ class V20 extends Migration str_contains($from, '$all') || str_contains($from, '.total') ) { - $query = $this->projectDB->sum('stats', 'value', [ + $query = $this->dbForProject->sum('stats', 'value', [ Query::equal('metric', [$from]), Query::equal('period', ['1d']), ]); @@ -470,7 +470,7 @@ class V20 extends Migration if ($latestDocument !== null) { $paginationQueries[] = Query::cursorAfter($latestDocument); } - $stats = $this->projectDB->find('stats', \array_merge($paginationQueries, [ + $stats = $this->dbForProject->find('stats', \array_merge($paginationQueries, [ Query::equal('metric', [$from]), ])); @@ -479,10 +479,10 @@ class V20 extends Migration foreach ($stats as $stat) { $format = $stat['period'] === '1d' ? 'Y-m-d 00:00' : 'Y-m-d H:00'; $time = date($format, strtotime($stat['time'])); - $this->projectDB->deleteDocument('stats', $stat->getId()); + $this->dbForProject->deleteDocument('stats', $stat->getId()); $stat->setAttribute('$id', \md5("{$time}_{$stat['period']}_{$to}")); $stat->setAttribute('metric', $to); - $this->projectDB->createDocument('stats', $stat); + $this->dbForProject->createDocument('stats', $stat); Console::log("deleting metric {$from} and creating {$to}"); } $latestDocument = !empty(array_key_last($stats)) ? $stats[array_key_last($stats)] : null; @@ -610,7 +610,7 @@ class V20 extends Migration 'identifier' => $document->getAttribute('email'), ]); try { - $this->projectDB->createDocument('targets', $target); + $this->dbForProject->createDocument('targets', $target); } catch (Duplicate $th) { Console::warning("Email target for user {$document->getId()} already exists."); } @@ -625,7 +625,7 @@ class V20 extends Migration 'identifier' => $document->getAttribute('phone'), ]); try { - $this->projectDB->createDocument('targets', $target); + $this->dbForProject->createDocument('targets', $target); } catch (Duplicate $th) { Console::warning("Email target for user {$document->getId()} already exists."); } diff --git a/src/Appwrite/Migration/Version/V21.php b/src/Appwrite/Migration/Version/V21.php index c072c81a34..38e8a8d513 100644 --- a/src/Appwrite/Migration/Version/V21.php +++ b/src/Appwrite/Migration/Version/V21.php @@ -29,7 +29,7 @@ class V21 extends Migration } Console::log('Migrating Project: ' . $this->project->getAttribute('name') . ' (' . $this->project->getId() . ')'); - $this->projectDB->setNamespace("_{$this->project->getInternalId()}"); + $this->dbForProject->setNamespace("_{$this->project->getInternalId()}"); Console::info('Migrating Collections'); $this->migrateCollections(); @@ -63,13 +63,13 @@ class V21 extends Migration Console::log("Migrating Collection \"{$id}\""); - $this->projectDB->setNamespace("_$internalProjectId"); + $this->dbForProject->setNamespace("_$internalProjectId"); switch ($id) { case 'projects': // Create accessedAt attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'accessedAt'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'accessedAt'); } catch (Throwable $th) { Console::warning("'accessedAt' from {$id}: {$th->getMessage()}"); } @@ -79,7 +79,7 @@ class V21 extends Migration foreach ($attributesToCreate as $attribute) { // Create attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, $attribute); + $this->createAttributeFromCollection($this->dbForProject, $id, $attribute); } catch (Throwable $th) { Console::warning("'$attribute' from {$id}: {$th->getMessage()}"); } @@ -89,7 +89,7 @@ class V21 extends Migration foreach ($indexesToCreate as $index) { // Create index try { - $this->createIndexFromCollection($this->projectDB, $id, $index); + $this->createIndexFromCollection($this->dbForProject, $id, $index); } catch (Throwable $th) { Console::warning("'$index' from {$id}: {$th->getMessage()}"); } @@ -98,7 +98,7 @@ class V21 extends Migration case 'platforms': // Increase 'type' length to 255 try { - $this->projectDB->updateAttribute($id, 'type', size: 255); + $this->dbForProject->updateAttribute($id, 'type', size: 255); } catch (Throwable $th) { Console::warning("'type' from {$id}: {$th->getMessage()}"); } @@ -108,7 +108,7 @@ class V21 extends Migration foreach ($attributesToCreate as $attribute) { // Create attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, $attribute); + $this->createAttributeFromCollection($this->dbForProject, $id, $attribute); } catch (Throwable $th) { Console::warning("'$attribute' from {$id}: {$th->getMessage()}"); } @@ -117,7 +117,7 @@ class V21 extends Migration case 'migrations': // Create destination attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'destination'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'destination'); } catch (Throwable $th) { Console::warning("'destination' from {$id}: {$th->getMessage()}"); } @@ -125,7 +125,7 @@ class V21 extends Migration case 'schedules': // Create data attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'data'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'data'); } catch (Throwable $th) { Console::warning("'data' from {$id}: {$th->getMessage()}"); } @@ -134,7 +134,7 @@ class V21 extends Migration case 'databases': // Create originalId attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'originalId'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'originalId'); } catch (Throwable $th) { Console::warning("'originalId' from {$id}: {$th->getMessage()}"); } @@ -142,14 +142,14 @@ class V21 extends Migration case 'functions': // Create scopes attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'scopes'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'scopes'); } catch (Throwable $th) { Console::warning("'scopes' from {$id}: {$th->getMessage()}"); } // Create specification attribute try { - $this->createAttributeFromCollection($this->projectDB, $id, 'specification'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'specification'); } catch (Throwable $th) { Console::warning("'specification' from {$id}: {$th->getMessage()}"); } @@ -158,21 +158,21 @@ class V21 extends Migration case 'executions': // Create requestMethod index try { - $this->createIndexFromCollection($this->projectDB, $id, '_key_requestMethod'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_requestMethod'); } catch (\Throwable $th) { Console::warning("'_key_requestMethod' from {$id}: {$th->getMessage()}"); } // Create requestPath index try { - $this->createIndexFromCollection($this->projectDB, $id, '_key_requestPath'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_requestPath'); } catch (\Throwable $th) { Console::warning("'_key_requestPath' from {$id}: {$th->getMessage()}"); } // Create deployment index try { - $this->createIndexFromCollection($this->projectDB, $id, '_key_deployment'); + $this->createIndexFromCollection($this->dbForProject, $id, '_key_deployment'); } catch (\Throwable $th) { Console::warning("'_key_deployment' from {$id}: {$th->getMessage()}"); } @@ -181,7 +181,7 @@ class V21 extends Migration /** * Create 'scheduledAt' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'scheduledAt'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'scheduledAt'); } catch (\Throwable $th) { Console::warning("'scheduledAt' from {$id}: {$th->getMessage()}"); } @@ -190,7 +190,7 @@ class V21 extends Migration /** * Create 'scheduleInternalId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'scheduleInternalId'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'scheduleInternalId'); } catch (\Throwable $th) { Console::warning("'scheduleInternalId' from {$id}: {$th->getMessage()}"); } @@ -199,7 +199,7 @@ class V21 extends Migration /** * Create 'scheduleId' attribute */ - $this->createAttributeFromCollection($this->projectDB, $id, 'scheduleId'); + $this->createAttributeFromCollection($this->dbForProject, $id, 'scheduleId'); } catch (\Throwable $th) { Console::warning("'scheduleId' from {$id}: {$th->getMessage()}"); } @@ -236,7 +236,7 @@ class V21 extends Migration // Set specification attribute if (empty($document->getAttribute('specification'))) { - $document->setAttribute('specification', APP_FUNCTION_SPECIFICATION_DEFAULT); + $document->setAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT); } } @@ -250,34 +250,34 @@ class V21 extends Migration */ private function migrateBuckets(): void { - foreach ($this->documentsIterator('buckets') as $bucket) { + $this->dbForProject->forEach('buckets', function (Document $bucket) { $bucketId = 'bucket_' . $bucket['$internalId']; Console::log("Migrating Bucket {$bucketId} {$bucket->getId()} ({$bucket->getAttribute('name')})"); try { - $this->projectDB->updateAttribute($bucketId, 'metadata', size: 65534); + $this->dbForProject->updateAttribute($bucketId, 'metadata', size: 65534); } catch (\Throwable $th) { Console::warning("'metadata' from {$bucketId}: {$th->getMessage()}"); } try { - $this->createAttributeFromCollection($this->projectDB, $bucketId, 'transformedAt', 'files'); + $this->createAttributeFromCollection($this->dbForProject, $bucketId, 'transformedAt', 'files'); } catch (\Throwable $th) { Console::warning("'transformedAt' from {$bucketId}: {$th->getMessage()}"); } try { - $this->createIndexFromCollection($this->projectDB, $bucketId, '_key_transformedAt', 'files'); + $this->createIndexFromCollection($this->dbForProject, $bucketId, '_key_transformedAt', 'files'); } catch (\Throwable $th) { Console::warning("'_key_transformedAt' from {$bucketId}: {$th->getMessage()}"); } try { - $this->projectDB->purgeCachedCollection($bucketId); + $this->dbForProject->purgeCachedCollection($bucketId); } catch (\Throwable $th) { Console::warning("purging {$bucketId}: {$th->getMessage()}"); } - } + }); } } diff --git a/src/Appwrite/Migration/Version/V22.php b/src/Appwrite/Migration/Version/V22.php new file mode 100644 index 0000000000..e485fb5bd0 --- /dev/null +++ b/src/Appwrite/Migration/Version/V22.php @@ -0,0 +1,607 @@ +<?php + +namespace Appwrite\Migration\Version; + +use Appwrite\Migration\Migration; +use Exception; +use Throwable; +use Utopia\CLI\Console; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Conflict; +use Utopia\Database\Exception\Structure; +use Utopia\Database\Exception\Timeout; +use Utopia\Database\Query; + +class V22 extends Migration +{ + /** + * @throws Throwable + */ + public function execute(): void + { + /** + * Disable SubQueries for Performance. + */ + foreach (['subQueryIndexes', 'subQueryPlatforms', 'subQueryDomains', 'subQueryKeys', 'subQueryDevKeys', 'subQueryWebhooks', 'subQuerySessions', 'subQueryTokens', 'subQueryMemberships', 'subQueryVariables', 'subQueryChallenges', 'subQueryProjectVariables', 'subQueryTargets', 'subQueryTopicTargets'] as $name) { + Database::addFilter( + $name, + fn () => null, + fn () => [] + ); + } + + Console::info('Migrating collections'); + $this->migrateCollections(); + + Console::info('Migrating documents'); + $this->forEachDocument($this->migrateDocument(...)); + + Console::info('Cleaning up collections'); + $this->cleanCollections(); + } + + /** + * Migrate Collections. + * + * @return void + * @throws Exception|Throwable + */ + private function migrateCollections(): void + { + $projectInternalId = $this->project->getInternalId(); + + if (empty($projectInternalId)) { + throw new Exception('Project ID is null'); + } + + $collectionType = match ($projectInternalId) { + 'console' => 'console', + default => 'projects', + }; + + $collections = $this->collections[$collectionType]; + + foreach ($collections as $collection) { + $id = $collection['$id']; + + if (empty($id)) { + continue; + } + + Console::log("Migrating collection \"{$id}\""); + + switch ($id) { + case '_metadata': + $this->createCollection('sites'); + $this->createCollection('resourceTokens'); + if ($projectInternalId === 'console') { + $this->createCollection('devKeys'); + } + break; + case 'identities': + $attributes = [ + 'scopes', + 'expire', + ]; + try { + $this->createAttributesFromCollection($this->dbForProject, $id, $attributes); + } catch (\Throwable $th) { + Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}"); + } + $this->dbForProject->purgeCachedCollection($id); + break; + case 'projects': + try { + $attributes = [ + 'devKeys', + ]; + $this->createAttributesFromCollection($this->dbForProject, $id, $attributes); + } catch (\Throwable $th) { + Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}"); + } + $this->dbForProject->purgeCachedCollection($id); + break; + case 'rules': + $attributes = [ + 'type', + 'trigger', + 'redirectUrl', + 'redirectStatusCode', + 'deploymentResourceType', + 'deploymentId', + 'deploymentInternalId', + 'deploymentResourceId', + 'deploymentResourceInternalId', + 'deploymentVcsProviderBranch', + 'search' + ]; + try { + $this->createAttributesFromCollection($this->dbForProject, $id, $attributes); + } catch (\Throwable $th) { + Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}"); + } + + $indexes = [ + '_key_search', + '_key_type', + '_key_trigger', + '_key_deploymentResourceType', + '_key_deploymentResourceId', + '_key_deploymentResourceInternalId', + '_key_deploymentId', + '_key_deploymentInternalId', + '_key_deploymentVcsProviderBranch', + ]; + + foreach ($indexes as $index) { + try { + $this->createIndexFromCollection($this->dbForProject, $id, $index); + } catch (\Throwable $th) { + Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); + } + } + $this->dbForProject->purgeCachedCollection($id); + break; + case 'memberships': + $indexes = [ + '_key_roles', + ]; + foreach ($indexes as $index) { + try { + $this->createIndexFromCollection($this->dbForProject, $id, $index); + } catch (Throwable $th) { + Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); + } + } + $this->dbForProject->purgeCachedCollection($id); + break; + case 'migrations': + $attributes = [ + 'options', + 'resourceId', + 'resourceType' + ]; + try { + $this->createAttributesFromCollection($this->dbForProject, $id, $attributes); + } catch (\Throwable $th) { + Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}"); + } + + $indexes = [ + '_key_resource_id', + ]; + + foreach ($indexes as $index) { + try { + $this->createIndexFromCollection($this->dbForProject, $id, $index); + } catch (Throwable $th) { + Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); + } + } + + $this->dbForProject->purgeCachedCollection($id); + break; + case 'functions': + $attributes = [ + 'deploymentId', + 'deploymentCreatedAt', + 'latestDeploymentId', + 'latestDeploymentInternalId', + 'latestDeploymentCreatedAt', + 'latestDeploymentStatus', + ]; + try { + $this->createAttributesFromCollection($this->dbForProject, $id, $attributes); + } catch (\Throwable $th) { + Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}"); + } + + $indexes = [ + '_key_deploymentId', + ]; + + foreach ($indexes as $index) { + try { + $this->createIndexFromCollection($this->dbForProject, $id, $index); + } catch (Throwable $th) { + Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); + } + } + + $this->dbForProject->purgeCachedCollection($id); + break; + case 'deployments': + $attributes = [ + 'buildCommands', + 'sourcePath', + 'buildOutput', + 'adapter', + 'fallbackFile', + 'sourceSize', + 'sourceMetadata', + 'sourceChunksTotal', + 'sourceChunksUploaded', + 'screenshotLight', + 'screenshotDark', + 'buildStartedAt', + 'buildEndedAt', + 'buildDuration', + 'buildSize', + 'status', + 'buildPath', + 'buildLogs', + 'totalSize', + ]; + try { + $this->createAttributesFromCollection($this->dbForProject, $id, $attributes); + } catch (\Throwable $th) { + Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}"); + } + + $indexes = [ + '_key_sourceSize', + '_key_buildSize', + '_key_totalSize', + '_key_buildDuration', + '_key_type', + '_key_status', + ]; + + foreach ($indexes as $index) { + try { + $this->createIndexFromCollection($this->dbForProject, $id, $index); + } catch (\Throwable $th) { + Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); + } + } + + $this->dbForProject->purgeCachedCollection($id); + break; + case 'executions': + $attributes = [ + 'resourceInternalId', + 'resourceId', + 'resourceType' + ]; + try { + $this->createAttributesFromCollection($this->dbForProject, $id, $attributes); + } catch (\Throwable $th) { + Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}"); + } + + $indexes = [ + '_key_resource', + ]; + foreach ($indexes as $index) { + try { + $this->createIndexFromCollection($this->dbForProject, $id, $index); + } catch (\Throwable $th) { + Console::warning("Failed to create index \"$index\" from {$id}: {$th->getMessage()}"); + } + } + + $this->dbForProject->purgeCachedCollection($id); + break; + case 'variables': + $attributes = [ + 'secret', + ]; + try { + $this->createAttributesFromCollection($this->dbForProject, $id, $attributes); + } catch (\Throwable $th) { + Console::warning('Failed to create attributes "' . \implode(', ', $attributes) . "\" in collection {$id}: {$th->getMessage()}"); + } + + $this->dbForProject->purgeCachedCollection($id); + break; + default: + break; + } + } + } + + /** + * Fix run on each document + * + * @param Document $document + * @return Document + * @throws Conflict + * @throws Structure + * @throws Timeout + * @throws \Utopia\Database\Exception + * @throws \Utopia\Database\Exception\Authorization + * @throws \Utopia\Database\Exception\Query + */ + private function migrateDocument(Document $document): Document + { + switch ($document->getCollection()) { + case 'rules': + /* + 1. Convert "resourceType" to "type". Convert "function" to "deployment" + 2. Convert "resourceId" to "deploymentResourceId" + 3. Convert "resourceInternalId" to "deploymentResourceInternalId" + 4. Fill "trigger" with "manual" + 5. Fill "deploymentResourceType". If "resourceType" is "function", set "deploymentResourceType" to "function" + 6. Fill "search" with "{$id} {domain}" + 7. Fill "deploymentId" and "deploymentInternalId". If "deploymentResourceType" is "function", get project DB, and find function with ID "resourceId". Then fill rule's "deploymentId" with function's "deployment", and "deploymentId" as backup + */ + + $deploymentResourceType = null; + + $type = $document->getAttribute('resourceType', $document->getAttribute('type', '')); + if ($type === 'function') { + $type = 'deployment'; + $deploymentResourceType = 'function'; + } + + $resourceId = $document->getAttribute('resourceId', $document->getAttribute('deploymentResourceId')); + $resourceInternalId = $document->getAttribute('resourceInternalId', $document->getAttribute('deploymentResourceInternalId')); + + $document + ->setAttribute('type', $type) + ->setAttribute('trigger', 'manual') + ->setAttribute('deploymentResourceId', $resourceId) + ->setAttribute('deploymentResourceInternalId', $resourceInternalId) + ->setAttribute('deploymentResourceType', $document->getAttribute('deploymentResourceType', $deploymentResourceType)) + ->setAttribute('search', \implode(' ', [$document->getId(), $document->getAttribute('domain', '')])); + + if ($deploymentResourceType === 'function') { + $project = $this->dbForProject->getDocument('projects', $document->getAttribute('projectId')); + $dbForOwnerProject = ($this->getProjectDB)($project); + $function = $dbForOwnerProject->getDocument('functions', $resourceId); + $deploymentId = $function->getAttribute('deployment', $function->getAttribute('deploymentId', $document->getAttribute('deploymentId'))); + $deploymentInternalId = $function->getAttribute('deploymentInternalId', $document->getAttribute('deploymentInternalId', '')); + + $document + ->setAttribute('deploymentId', $deploymentId) + ->setAttribute('deploymentInternalId', $deploymentInternalId); + } + break; + case 'variables': + /* + 1. Fill "secret" with "false" + */ + $document->setAttribute('secret', $document->getAttribute('secret', false)); + break; + case 'executions': + /* + 1. Convert "functionInternalId" to "resourceInternalId" + 2. Convert "functionId" to "resourceId" + 3. Fill "resourceType" with "functions" + */ + $document + ->setAttribute('resourceInternalId', $document->getAttribute('functionInternalId', $document->getAttribute('resourceInternalId'))) + ->setAttribute('resourceId', $document->getAttribute('functionId', $document->getAttribute('resourceId', ''))) + ->setAttribute('resourceType', $document->getAttribute('resourceType', 'functions')); + break; + case 'functions': + /* + 1. Convert "deployment" to "deploymentId" + --- Fetch activeDeployment from "deploymentId" + 2. Fill "deploymentCreatedAt" with deployment's "$createdAt" + --- Fetch latestDeployment using find() + 3. Fill latestDeploymentId with latestDeployment's "$id" + 4. Fill latestDeploymentInternalId with latestDeployment's "$internalId" + 5. Fill latestDeploymentCreatedAt with latestDeployment's "$createdAt" + 6. Fill latestDeploymentStatus with latestDeployment's build's "status" + */ + if ($document->getAttribute('deployment')) { + $document->setAttribute('deploymentId', $document->getAttribute('deployment', $document->getAttribute('deploymentId', ''))); + } + + $deploymentId = $document->getAttribute('deploymentId'); + $deployment = $this->dbForProject->getDocument('deployments', $deploymentId); + $document->setAttribute('deploymentCreatedAt', $deployment->getCreatedAt()); + + $latestDeployment = $this->dbForProject->findOne('deployments', [ + Query::orderDesc(), + Query::equal('resourceId', [$document->getId()]), + Query::equal('resourceType', ['functions']), + ]); + + $latestBuild = $this->dbForProject->getDocument('builds', $latestDeployment->getAttribute('buildId', '')); + + $document + ->setAttribute('latestDeploymentId', $latestDeployment->getId()) + ->setAttribute('latestDeploymentInternalId', $latestDeployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $latestDeployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $latestBuild->getAttribute('status', $document->getAttribute('latestDeploymentStatus', ''))); + break; + case 'deployments': + /* + 6. Convert "commands" to "buildCommands" + 7. Convert "path" to "sourcePath" + 8. Convert "size" to "sourceSize" + 9. Convert "metadata" to "sourceMetadata" + 10. Convert "chunksTotal" to "sourceChunksTotal" + 11. Convert "chunksUploaded" to "sourceChunksUploaded" + --- Get build of deployment + 12. Convert build's "startTime" to "buildStartedAt" + 13. Convert build's "endTime" to "buildEndedAt" + 14. Convert build's "duration" to "buildDuration" + 15. Convert build's "size" to "buildSize" + 16. Convert build's "status" to "status" + 17. Convert build's "path" to "buildPath" + 18. Convert build's "logs" to "buildLogs" + 19. Fill "totalSize" with "buildSize" plus "sourceSize" + */ + + $document + ->setAttribute('buildCommands', $document->getAttribute('commands', $document->getAttribute('buildCommands', ''))) + ->setAttribute('sourcePath', $document->getAttribute('path', $document->getAttribute('sourcePath', ''))) + ->setAttribute('sourceSize', $document->getAttribute('size', $document->getAttribute('sourceSize', 0))) + ->setAttribute('sourceMetadata', $document->getAttribute('metadata', $document->getAttribute('sourceMetadata', []))) + ->setAttribute('sourceChunksTotal', $document->getAttribute('chunksTotal', $document->getAttribute('sourceChunksTotal', 0))) + ->setAttribute('sourceChunksUploaded', $document->getAttribute('chunksUploaded', $document->getAttribute('sourceChunksUploaded', 0))); + + $build = new Document(); + if (!empty($document->getAttribute('buildId'))) { + $build = $this->dbForProject->getDocument('builds', $document->getAttribute('buildId')); + } + + $document + ->setAttribute('buildStartedAt', $build->getAttribute('startTime', $document->getAttribute('buildStartTime', ''))) + ->setAttribute('buildEndedAt', $build->getAttribute('endTime', $document->getAttribute('buildEndTime', ''))) + ->setAttribute('buildDuration', $build->getAttribute('duration', $document->getAttribute('buildDuration', 0))) + ->setAttribute('buildSize', $build->getAttribute('size', $document->getAttribute('buildSize', 0))) + ->setAttribute('status', $build->getAttribute('status', $document->getAttribute('status', ''))) + ->setAttribute('buildPath', $build->getAttribute('path', $document->getAttribute('buildPath', ''))) + ->setAttribute('buildLogs', $build->getAttribute('logs', $document->getAttribute('buildLogs', ''))); + + $totalSize = $document->getAttribute('buildSize', 0) + + $document->getAttribute('sourceSize', 0); + + $document->setAttribute('totalSize', $totalSize); + break; + case 'migrations': + /* + 1. Fill "options" with "[]" + */ + $document->setAttribute('options', $document->getAttribute('options', [])); + break; + default: + break; + } + return $document; + } + + private function cleanCollections(): void + { + $projectInternalId = $this->project->getInternalId(); + + $collectionType = match ($projectInternalId) { + 'console' => 'console', + default => 'projects', + }; + + $collections = $this->collections[$collectionType]; + foreach ($collections as $collection) { + $id = $collection['$id']; + + Console::log("Cleaning up collection \"{$id}\""); + + switch ($id) { + case '_metadata': + if (!$this->dbForProject->getCollection('builds')->isEmpty()) { + $this->dbForProject->deleteCollection('builds'); + } + break; + case 'rules': + $attributes = [ + 'resourceId', + 'resourceInternalId', + 'resourceType', + ]; + foreach ($attributes as $attribute) { + try { + $this->dbForProject->deleteAttribute($id, $attribute); + } catch (\Throwable $th) { + Console::warning("Failed to delete attribute \"$attribute\" from collection {$id}: {$th->getMessage()}"); + } + } + + $indexesToDelete = [ + '_key_resourceId', + '_key_resourceInternalId', + '_key_resourceType', + ]; + foreach ($indexesToDelete as $index) { + try { + $this->dbForProject->deleteIndex($id, $index); + } catch (\Throwable $th) { + Console::warning("Failed to delete index \"$index\" from collection {$id}: {$th->getMessage()}"); + } + } + + $this->dbForProject->purgeCachedCollection($id); + break; + case 'functions': + try { + $this->dbForProject->deleteAttribute($id, 'deployment'); + } catch (\Throwable $th) { + Console::warning("Failed to delete attribute \"deployment\" from collection {$id}: {$th->getMessage()}"); + } + + $indexesToDelete = [ + '_key_deployment' + ]; + foreach ($indexesToDelete as $index) { + try { + $this->dbForProject->deleteIndex($id, $index); + } catch (\Throwable $th) { + Console::warning("Failed to delete index \"$index\" from collection {$id}: {$th->getMessage()}"); + } + } + + $this->dbForProject->purgeCachedCollection($id); + break; + case 'deployments': + $attributes = [ + 'buildInternalId', + 'buildId', + 'commands', + 'path', + 'size', + 'metadata', + 'chunksTotal', + 'chunksUploaded', + 'search' + ]; + foreach ($attributes as $attribute) { + try { + $this->dbForProject->deleteAttribute($id, $attribute); + } catch (\Throwable $th) { + Console::warning("Failed to delete attribute \"$attribute\" from collection {$id}: {$th->getMessage()}"); + } + } + + $indexesToDelete = [ + '_key_buildId', + '_key_size', + '_key_search' + ]; + foreach ($indexesToDelete as $index) { + try { + $this->dbForProject->deleteIndex($id, $index); + } catch (\Throwable $th) { + Console::warning("Failed to delete index \"$index\" from collection {$id}: {$th->getMessage()}"); + } + } + + $this->dbForProject->purgeCachedCollection($id); + break; + case 'executions': + $attributes = [ + 'functionId', + 'functionInternalId', + 'search' + ]; + foreach ($attributes as $attribute) { + try { + $this->dbForProject->deleteAttribute($id, $attribute); + } catch (\Throwable $th) { + Console::warning("Failed to delete attribute \"$attribute\" from collection {$id}: {$th->getMessage()}"); + } + } + + $indexesToDelete = [ + '_key_function', + '_fulltext_search' + ]; + foreach ($indexesToDelete as $index) { + try { + $this->dbForProject->deleteIndex($id, $index); + } catch (\Throwable $th) { + Console::warning("Failed to delete index \"$index\" from collection {$id}: {$th->getMessage()}"); + } + } + + $this->dbForProject->purgeCachedCollection($id); + break; + default: + break; + } + } + } +} diff --git a/src/Appwrite/Network/Validator/CNAME.php b/src/Appwrite/Network/Validator/DNS.php similarity index 53% rename from src/Appwrite/Network/Validator/CNAME.php rename to src/Appwrite/Network/Validator/DNS.php index e1ae061c84..73494ddc3e 100644 --- a/src/Appwrite/Network/Validator/CNAME.php +++ b/src/Appwrite/Network/Validator/DNS.php @@ -4,24 +4,22 @@ namespace Appwrite\Network\Validator; use Utopia\Validator; -class CNAME extends Validator +class DNS extends Validator { + public const RECORD_A = 'a'; + public const RECORD_AAAA = 'aaaa'; + public const RECORD_CNAME = 'cname'; + /** * @var mixed */ protected mixed $logs; - /** - * @var string - */ - protected $target; - /** * @param string $target */ - public function __construct($target) + public function __construct(protected string $target, protected string $type = self::RECORD_CNAME) { - $this->target = $target; } /** @@ -29,7 +27,7 @@ class CNAME extends Validator */ public function getDescription(): string { - return 'Invalid CNAME record'; + return 'Invalid DNS record'; } /** @@ -41,20 +39,34 @@ class CNAME extends Validator } /** - * Check if CNAME record target value matches selected target + * Check if DNS record value matches specific value * * @param mixed $domain * * @return bool */ - public function isValid($domain): bool + public function isValid($value): bool { - if (!is_string($domain)) { + $typeNative = match ($this->type) { + self::RECORD_A => DNS_A, + self::RECORD_AAAA => DNS_AAAA, + self::RECORD_CNAME => DNS_CNAME, + default => throw new \Exception('Record type not supported.') + }; + + $dnsKey = match ($this->type) { + self::RECORD_A => 'ip', + self::RECORD_AAAA => 'ipv6', + self::RECORD_CNAME => 'target', + default => throw new \Exception('Record type not supported.') + }; + + if (!is_string($value)) { return false; } try { - $records = \dns_get_record($domain, DNS_CNAME); + $records = \dns_get_record($value, $typeNative); $this->logs = $records; } catch (\Throwable $th) { return false; @@ -65,7 +77,7 @@ class CNAME extends Validator } foreach ($records as $record) { - if (isset($record['target']) && $record['target'] === $this->target) { + if (isset($record[$dnsKey]) && $record[$dnsKey] === $this->target) { return true; } } diff --git a/src/Appwrite/Platform/Appwrite.php b/src/Appwrite/Platform/Appwrite.php index 6b3eb077fa..5752432257 100644 --- a/src/Appwrite/Platform/Appwrite.php +++ b/src/Appwrite/Platform/Appwrite.php @@ -2,7 +2,13 @@ namespace Appwrite\Platform; +use Appwrite\Platform\Modules\Console; use Appwrite\Platform\Modules\Core; +use Appwrite\Platform\Modules\Functions; +use Appwrite\Platform\Modules\Projects; +use Appwrite\Platform\Modules\Proxy; +use Appwrite\Platform\Modules\Sites; +use Appwrite\Platform\Modules\Tokens; use Utopia\Platform\Platform; class Appwrite extends Platform @@ -10,5 +16,11 @@ class Appwrite extends Platform public function __construct() { parent::__construct(new Core()); + $this->addModule(new Projects\Module()); + $this->addModule(new Functions\Module()); + $this->addModule(new Sites\Module()); + $this->addModule(new Console\Module()); + $this->addModule(new Proxy\Module()); + $this->addModule(new Tokens\Module()); } } diff --git a/src/Appwrite/Platform/Modules/Compute/Base.php b/src/Appwrite/Platform/Modules/Compute/Base.php new file mode 100644 index 0000000000..542b29bcd5 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Compute/Base.php @@ -0,0 +1,274 @@ +<?php + +namespace Appwrite\Platform\Modules\Compute; + +use Appwrite\Event\Build; +use Appwrite\Extend\Exception; +use Appwrite\Query; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\Authorization; +use Utopia\Platform\Action; +use Utopia\Swoole\Request; +use Utopia\System\System; +use Utopia\VCS\Adapter\Git\GitHub; +use Utopia\VCS\Exception\RepositoryNotFound; + +class Base extends Action +{ + public function redeployVcsFunction(Request $request, Document $function, Document $project, Document $installation, Database $dbForProject, Build $queueForBuilds, Document $template, GitHub $github, bool $activate, string $referenceType = 'branch', string $reference = ''): Document + { + $deploymentId = ID::unique(); + $entrypoint = $function->getAttribute('entrypoint', ''); + $providerInstallationId = $installation->getAttribute('providerInstallationId', ''); + $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); + $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID'); + $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); + $owner = $github->getOwnerName($providerInstallationId); + $providerRepositoryId = $function->getAttribute('providerRepositoryId', ''); + try { + $repositoryName = $github->getRepositoryName($providerRepositoryId) ?? ''; + if (empty($repositoryName)) { + throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND); + } + } catch (RepositoryNotFound $e) { + throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND); + } + + $commitDetails = []; + $branchUrl = ""; + $providerBranch = ""; + + // TODO: Support tag in future + if ($referenceType === 'branch') { + $providerBranch = empty($reference) ? $function->getAttribute('providerBranch', 'main') : $reference; + $branchUrl = "https://github.com/$owner/$repositoryName/tree/$providerBranch"; + try { + $commitDetails = $github->getLatestCommit($owner, $repositoryName, $providerBranch); + } catch (\Throwable $error) { + // Ignore; deployment can continue + } + } elseif ($referenceType === 'commit') { + try { + $commitDetails = $github->getCommit($owner, $repositoryName, $reference); + } catch (\Throwable $error) { + // Ignore; deployment can continue + } + } + + $repositoryUrl = "https://github.com/$owner/$repositoryName"; + + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceId' => $function->getId(), + 'resourceInternalId' => $function->getInternalId(), + 'resourceType' => 'functions', + 'entrypoint' => $entrypoint, + 'buildCommands' => $function->getAttribute('commands', ''), + 'type' => 'vcs', + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'repositoryId' => $function->getAttribute('repositoryId', ''), + 'repositoryInternalId' => $function->getAttribute('repositoryInternalId', ''), + 'providerBranchUrl' => $branchUrl, + 'providerRepositoryName' => $repositoryName, + 'providerRepositoryOwner' => $owner, + 'providerRepositoryUrl' => $repositoryUrl, + 'providerCommitHash' => $commitDetails['commitHash'] ?? '', + 'providerCommitAuthorUrl' => $commitDetails['commitAuthorUrl'] ?? '', + 'providerCommitAuthor' => $commitDetails['commitAuthor'] ?? '', + 'providerCommitMessage' => mb_strimwidth($commitDetails['commitMessage'] ?? '', 0, 255, '...'), + 'providerCommitUrl' => $commitDetails['commitUrl'] ?? '', + 'providerBranch' => $providerBranch, + 'providerRootDirectory' => $function->getAttribute('providerRootDirectory', ''), + 'search' => implode(' ', [$deploymentId, $entrypoint]), + 'activate' => $activate, + ])); + + $function = $function + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('functions', $function->getId(), $function); + + $queueForBuilds + ->setType(BUILD_TYPE_DEPLOYMENT) + ->setResource($function) + ->setDeployment($deployment) + ->setTemplate($template); + + return $deployment; + } + + public function redeployVcsSite(Request $request, Document $site, Document $project, Document $installation, Database $dbForProject, Database $dbForPlatform, Build $queueForBuilds, Document $template, GitHub $github, bool $activate, string $referenceType = 'branch', string $reference = ''): Document + { + $deploymentId = ID::unique(); + $providerInstallationId = $installation->getAttribute('providerInstallationId', ''); + $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); + $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID'); + $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); + $owner = $github->getOwnerName($providerInstallationId); + $providerRepositoryId = $site->getAttribute('providerRepositoryId', ''); + try { + $repositoryName = $github->getRepositoryName($providerRepositoryId) ?? ''; + if (empty($repositoryName)) { + throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND); + } + } catch (RepositoryNotFound $e) { + throw new Exception(Exception::PROVIDER_REPOSITORY_NOT_FOUND); + } + + $commitDetails = []; + $branchUrl = ""; + $providerBranch = ""; + + // TODO: Support tag in future + if ($referenceType === 'branch') { + $providerBranch = empty($reference) ? $site->getAttribute('providerBranch', 'main') : $reference; + $branchUrl = "https://github.com/$owner/$repositoryName/tree/$providerBranch"; + try { + $commitDetails = $github->getLatestCommit($owner, $repositoryName, $providerBranch); + } catch (\Throwable $error) { + // Ignore; deployment can continue + } + } elseif ($referenceType === 'commit') { + try { + $commitDetails = $github->getCommit($owner, $repositoryName, $reference); + } catch (\Throwable $error) { + // Ignore; deployment can continue + } + } + + $repositoryUrl = "https://github.com/$owner/$repositoryName"; + + $commands = []; + if (!empty($site->getAttribute('installCommand', ''))) { + $commands[] = $site->getAttribute('installCommand', ''); + } + if (!empty($site->getAttribute('buildCommand', ''))) { + $commands[] = $site->getAttribute('buildCommand', ''); + } + + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceId' => $site->getId(), + 'resourceInternalId' => $site->getInternalId(), + 'resourceType' => 'sites', + 'buildCommands' => implode(' && ', $commands), + 'buildOutput' => $site->getAttribute('outputDirectory', ''), + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), + 'type' => 'vcs', + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'repositoryId' => $site->getAttribute('repositoryId', ''), + 'repositoryInternalId' => $site->getAttribute('repositoryInternalId', ''), + 'providerBranchUrl' => $branchUrl, + 'providerRepositoryName' => $repositoryName, + 'providerRepositoryOwner' => $owner, + 'providerRepositoryUrl' => $repositoryUrl, + 'providerCommitHash' => $commitDetails['commitHash'] ?? '', + 'providerCommitAuthorUrl' => $commitDetails['commitAuthorUrl'] ?? '', + 'providerCommitAuthor' => $commitDetails['commitAuthor'] ?? '', + 'providerCommitMessage' => mb_strimwidth($commitDetails['commitMessage'] ?? '', 0, 255, '...'), + 'providerCommitUrl' => $commitDetails['commitUrl'] ?? '', + 'providerBranch' => $providerBranch, + 'providerRootDirectory' => $site->getAttribute('providerRootDirectory', ''), + 'search' => implode(' ', [$deploymentId]), + 'activate' => $activate, + ])); + + $site = $site + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('sites', $site->getId(), $site); + + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + $domain = ID::unique() . "." . $sitesDomain; + + // TODO: @christyjacob remove once we migrate the rules in 1.7.x + $ruleId = System::getEnv('_APP_RULES_FORMAT') === 'md5' ? md5($domain) : ID::unique(); + + Authorization::skip( + fn () => $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain, + 'trigger' => 'deployment', + 'type' => 'deployment', + 'deploymentId' => $deployment->getId(), + 'deploymentInternalId' => $deployment->getInternalId(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $site->getId(), + 'deploymentResourceInternalId' => $site->getInternalId(), + 'deploymentVcsProviderBranch' => $providerBranch, + 'status' => 'verified', + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain]), + 'owner' => 'Appwrite', + 'region' => $project->getAttribute('region') + ])) + ); + + $queueForBuilds + ->setType(BUILD_TYPE_DEPLOYMENT) + ->setResource($site) + ->setDeployment($deployment) + ->setTemplate($template); + + return $deployment; + } + + protected function listRules(Document $project, array $queries, Database $database, callable $callback): void + { + $limit = 100; + $cursor = null; + + do { + $queries = \array_merge([ + Query::limit($limit), + Query::equal("projectInternalId", [$project->getInternalId()]) + ], $queries); + + if ($cursor !== null) { + $queries[] = Query::cursorAfter($cursor); + } + + $results = $database->find('rules', $queries); + + $total = \count($results); + if ($total > 0) { + $cursor = $results[$total - 1]; + } + + if ($total < $limit) { + $cursor = null; + } + + foreach ($results as $document) { + if (is_callable($callback)) { + $callback($document); + } + } + } while (!\is_null($cursor)); + } +} diff --git a/src/Appwrite/Functions/Specification.php b/src/Appwrite/Platform/Modules/Compute/Specification.php similarity index 91% rename from src/Appwrite/Functions/Specification.php rename to src/Appwrite/Platform/Modules/Compute/Specification.php index 50a3c02b62..cf48896a7b 100644 --- a/src/Appwrite/Functions/Specification.php +++ b/src/Appwrite/Platform/Modules/Compute/Specification.php @@ -1,6 +1,6 @@ <?php -namespace Appwrite\Functions; +namespace Appwrite\Platform\Modules\Compute; class Specification { diff --git a/src/Appwrite/Functions/Validator/RuntimeSpecification.php b/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php similarity index 96% rename from src/Appwrite/Functions/Validator/RuntimeSpecification.php rename to src/Appwrite/Platform/Modules/Compute/Validator/Specification.php index b9185d832a..5c6cf9ce1f 100644 --- a/src/Appwrite/Functions/Validator/RuntimeSpecification.php +++ b/src/Appwrite/Platform/Modules/Compute/Validator/Specification.php @@ -1,10 +1,10 @@ <?php -namespace Appwrite\Functions\Validator; +namespace Appwrite\Platform\Modules\Compute\Validator; use Utopia\Validator; -class RuntimeSpecification extends Validator +class Specification extends Validator { private array $plan; diff --git a/src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php b/src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php new file mode 100644 index 0000000000..16a94dc00c --- /dev/null +++ b/src/Appwrite/Platform/Modules/Console/Http/Resources/Get.php @@ -0,0 +1,90 @@ +<?php + +namespace Appwrite\Platform\Modules\Console\Http\Resources; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Domain; +use Utopia\Validator\Text; +use Utopia\Validator\WhiteList; + +class Get extends Action +{ + use HTTP; + + public static function getName() + { + return 'getResource'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/console/resources') + ->desc('Check resource ID availability') + ->groups(['api', 'projects']) + ->label('scope', 'rules.read') + ->label('sdk', new Method( + namespace: 'console', + group: null, + name: 'getResource', + description: <<<EOT + Check if a resource ID is available. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE, + )) + ->label('abuse-limit', 120) + ->label('abuse-key', 'userId:{userId}, url:{url}') + ->label('abuse-time', 60) + ->param('value', '', new Text(256), 'Resource value.') + ->param('type', '', new WhiteList(['rules']), 'Resource type.') + ->inject('response') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action( + string $value, + string $type, + Response $response, + Database $dbForPlatform + ) { + if ($type === 'rules') { + $validator = new Domain($value); + + if (!$validator->isValid($value)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, $validator->getDescription()); + } + + $document = Authorization::skip(fn () => $dbForPlatform->findOne('rules', [ + Query::equal('domain', [$value]), + ])); + + if (!$document->isEmpty()) { + throw new Exception(Exception::RESOURCE_ALREADY_EXISTS); + } + + $response->noContent(); + } + + // Only occurs if type is added into whitelist, but not supported in action + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Invalid type'); + } +} diff --git a/src/Appwrite/Platform/Modules/Console/Module.php b/src/Appwrite/Platform/Modules/Console/Module.php new file mode 100644 index 0000000000..7bf2805479 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Console/Module.php @@ -0,0 +1,14 @@ +<?php + +namespace Appwrite\Platform\Modules\Console; + +use Appwrite\Platform\Modules\Console\Services\Http; +use Utopia\Platform; + +class Module extends Platform\Module +{ + public function __construct() + { + $this->addService('http', new Http()); + } +} diff --git a/src/Appwrite/Platform/Modules/Console/Services/Http.php b/src/Appwrite/Platform/Modules/Console/Services/Http.php new file mode 100644 index 0000000000..6221db6a96 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Console/Services/Http.php @@ -0,0 +1,16 @@ +<?php + +namespace Appwrite\Platform\Modules\Console\Services; + +use Appwrite\Platform\Modules\Console\Http\Resources\Get as GetResourceAvailability; +use Utopia\Platform\Service; + +class Http extends Service +{ + public function __construct() + { + $this->type = Service::TYPE_HTTP; + // Resources + $this->addAction(GetResourceAvailability::getName(), new GetResourceAvailability()); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php new file mode 100644 index 0000000000..54894f2caa --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Create.php @@ -0,0 +1,305 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Deployments; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\MethodType; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Query; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Storage\Device; +use Utopia\Storage\Validator\File; +use Utopia\Storage\Validator\FileExt; +use Utopia\Storage\Validator\FileSize; +use Utopia\Storage\Validator\Upload; +use Utopia\Swoole\Request; +use Utopia\System\System; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; + +class Create extends Action +{ + use HTTP; + + public static function getName() + { + return 'createDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/functions/:functionId/deployments') + ->desc('Create deployment') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('event', 'functions.[functionId].deployments.[deploymentId].create') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('audits.event', 'deployment.create') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'deployments', + name: 'createDeployment', + description: <<<EOT + Create a new function code deployment. Use this endpoint to upload a new version of your code function. To execute your newly uploaded code, you'll need to update the function's deployment to use your new deployment UID. + + This endpoint accepts a tar.gz file compressed with your code. Make sure to include any dependencies your code has within the compressed file. You can learn more about code packaging in the [Appwrite Cloud Functions tutorial](https://appwrite.io/docs/functions). + + Use the "command" param to set the entrypoint used to execute your code. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_ACCEPTED, + model: Response::MODEL_DEPLOYMENT, + ) + ], + requestType: ContentType::MULTIPART, + type: MethodType::UPLOAD, + packaging: true, + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('entrypoint', null, new Text(1028), 'Entrypoint File.', true) + ->param('commands', null, new Text(8192, 0), 'Build Commands.', true) + ->param('code', [], new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', skipValidation: true) + ->param('activate', false, new Boolean(true), 'Automatically activate the deployment when it is finished building.') + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->inject('project') + ->inject('deviceForFunctions') + ->inject('deviceForLocal') + ->inject('queueForBuilds') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + ?string $entrypoint, + ?string $commands, + mixed $code, + mixed $activate, + Request $request, + Response $response, + Database $dbForProject, + Event $queueForEvents, + Document $project, + Device $deviceForFunctions, + Device $deviceForLocal, + Build $queueForBuilds + ) { + $activate = \strval($activate) === 'true' || \strval($activate) === '1'; + + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + if ($entrypoint === null) { + $entrypoint = $function->getAttribute('entrypoint', ''); + } + + if ($commands === null) { + $commands = $function->getAttribute('commands', ''); + } + + if (empty($entrypoint)) { + throw new Exception(Exception::FUNCTION_ENTRYPOINT_MISSING); + } + + $file = $request->getFiles('code'); + + // GraphQL multipart spec adds files with index keys + if (empty($file)) { + $file = $request->getFiles(0); + } + + if (empty($file)) { + throw new Exception(Exception::STORAGE_FILE_EMPTY, 'No file sent'); + } + + $fileExt = new FileExt([FileExt::TYPE_GZIP]); + $fileSizeValidator = new FileSize(System::getEnv('_APP_COMPUTE_SIZE_LIMIT', '30000000')); + $upload = new Upload(); + + // Make sure we handle a single file and multiple files the same way + $fileName = (\is_array($file['name']) && isset($file['name'][0])) ? $file['name'][0] : $file['name']; + $fileTmpName = (\is_array($file['tmp_name']) && isset($file['tmp_name'][0])) ? $file['tmp_name'][0] : $file['tmp_name']; + $fileSize = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size']; + + if (!$fileExt->isValid($file['name'])) { // Check if file type is allowed + throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED); + } + + $contentRange = $request->getHeader('content-range'); + $deploymentId = ID::unique(); + $chunk = 1; + $chunks = 1; + + if (!empty($contentRange)) { + $start = $request->getContentRangeStart(); + $end = $request->getContentRangeEnd(); + $fileSize = $request->getContentRangeSize(); + $deploymentId = $request->getHeader('x-appwrite-id', $deploymentId); + // TODO make `end >= $fileSize` in next breaking version + if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { + throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); + } + + // TODO remove the condition that checks `$end === $fileSize` in next breaking version + if ($end === $fileSize - 1 || $end === $fileSize) { + //if it's a last chunks the chunk size might differ, so we set the $chunks and $chunk to notify it's last chunk + $chunks = $chunk = -1; + } else { + // Calculate total number of chunks based on the chunk size i.e ($rangeEnd - $rangeStart) + $chunks = (int) ceil($fileSize / ($end + 1 - $start)); + $chunk = (int) ($start / ($end + 1 - $start)) + 1; + } + } + + if (!$fileSizeValidator->isValid($fileSize)) { // Check if file size is exceeding allowed limit + throw new Exception(Exception::STORAGE_INVALID_FILE_SIZE); + } + + if (!$upload->isValid($fileTmpName)) { + throw new Exception(Exception::STORAGE_INVALID_FILE); + } + + // Save to storage + $fileSize ??= $deviceForLocal->getFileSize($fileTmpName); + $path = $deviceForFunctions->getPath($deploymentId . '.' . \pathinfo($fileName, PATHINFO_EXTENSION)); + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + $metadata = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)]; + if (!$deployment->isEmpty()) { + $chunks = $deployment->getAttribute('sourceChunksTotal', 1); + $metadata = $deployment->getAttribute('sourceMetadata', []); + if ($chunk === -1) { + $chunk = $chunks; + } + } + + $chunksUploaded = $deviceForFunctions->upload($fileTmpName, $path, $chunk, $chunks, $metadata); + + if (empty($chunksUploaded)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file'); + } + + $type = $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual'; + + if ($chunksUploaded === $chunks) { + if ($activate) { + // Remove deploy for all other deployments. + $activeDeployments = $dbForProject->find('deployments', [ + Query::equal('activate', [true]), + Query::equal('resourceId', [$functionId]), + Query::equal('resourceType', ['functions']) + ]); + + foreach ($activeDeployments as $activeDeployment) { + $activeDeployment->setAttribute('activate', false); + $dbForProject->updateDocument('deployments', $activeDeployment->getId(), $activeDeployment); + } + } + + $fileSize = $deviceForFunctions->getFileSize($path); + + if ($deployment->isEmpty()) { + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceInternalId' => $function->getInternalId(), + 'resourceId' => $function->getId(), + 'resourceType' => 'functions', + 'entrypoint' => $entrypoint, + 'buildCommands' => $commands, + 'sourcePath' => $path, + 'sourceSize' => $fileSize, + 'totalSize' => $fileSize, + 'activate' => $activate, + 'sourceMetadata' => $metadata, + 'type' => $type + ])); + + $function = $function + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('functions', $function->getId(), $function); + } else { + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment->setAttribute('sourceSize', $fileSize)->setAttribute('sourceMetadata', $metadata)); + } + + // Start the build + $queueForBuilds + ->setType(BUILD_TYPE_DEPLOYMENT) + ->setResource($function) + ->setDeployment($deployment); + } else { + if ($deployment->isEmpty()) { + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceInternalId' => $function->getInternalId(), + 'resourceId' => $function->getId(), + 'resourceType' => 'functions', + 'entrypoint' => $entrypoint, + 'buildCommands' => $commands, + 'sourcePath' => $path, + 'sourceSize' => $fileSize, + 'totalSize' => $fileSize, + 'sourceChunksTotal' => $chunks, + 'sourceChunksUploaded' => $chunksUploaded, + 'activate' => $activate, + 'sourceMetadata' => $metadata, + 'type' => $type + ])); + + $function = $function + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('functions', $function->getId(), $function); + } else { + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment->setAttribute('sourceChunksUploaded', $chunksUploaded)->setAttribute('sourceMetadata', $metadata)); + } + } + + $metadata = null; + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php new file mode 100644 index 0000000000..84878055d8 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Delete.php @@ -0,0 +1,136 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Deployments; + +use Appwrite\Event\Delete as DeleteEvent; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Query; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Storage\Device; + +class Delete extends Action +{ + use HTTP; + + public static function getName() + { + return 'deleteDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/functions/:functionId/deployments/:deploymentId') + ->desc('Delete deployment') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('event', 'functions.[functionId].deployments.[deploymentId].delete') + ->label('audits.event', 'deployment.delete') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'deployments', + name: 'deleteDeployment', + description: <<<EOT + Delete a code deployment by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForDeletes') + ->inject('queueForEvents') + ->inject('deviceForFunctions') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $deploymentId, + Response $response, + Database $dbForProject, + DeleteEvent $queueForDeletes, + Event $queueForEvents, + Device $deviceForFunctions + ) { + $function = $dbForProject->getDocument('functions', $functionId); + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if ($deployment->getAttribute('resourceId') !== $function->getId()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } + + if (!empty($deployment->getAttribute('sourcePath', ''))) { + if (!($deviceForFunctions->delete($deployment->getAttribute('sourcePath', '')))) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from storage'); + } + } + + if ($function->getAttribute('latestDeploymentId') === $deployment->getId()) { + $latestDeployment = $dbForProject->findOne('deployments', [ + Query::equal('resourceType', ['functions']), + Query::equal('resourceInternalId', [$function->getInternalId()]), + Query::orderDesc('$createdAt'), + ]); + $function = $dbForProject->updateDocument( + 'functions', + $function->getId(), + $function + ->setAttribute('latestDeploymentCreatedAt', $latestDeployment->isEmpty() ? '' : $latestDeployment->getCreatedAt()) + ->setAttribute('latestDeploymentInternalId', $latestDeployment->isEmpty() ? '' : $latestDeployment->getInternalId()) + ->setAttribute('latestDeploymentId', $latestDeployment->isEmpty() ? '' : $latestDeployment->getId()) + ->setAttribute('latestDeploymentStatus', $latestDeployment->isEmpty() ? '' : $latestDeployment->getAttribute('status', '')) + ); + } + + if ($function->getAttribute('deploymentId') === $deployment->getId()) { // Reset function deployment + $function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [ + 'deploymentId' => '', + 'deploymentInternalId' => '', + 'deploymentCreatedAt' => '', + ]))); + } + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $queueForDeletes + ->setType(DELETE_TYPE_DOCUMENT) + ->setDocument($deployment); + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php new file mode 100644 index 0000000000..9456ff13a6 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Download/Get.php @@ -0,0 +1,152 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Download; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\MethodType; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Storage\Device; +use Utopia\Swoole\Request; +use Utopia\Validator\WhiteList; + +class Get extends Action +{ + use HTTP; + + public static function getName() + { + return 'getDeploymentDownload'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/:functionId/deployments/:deploymentId/download') + ->httpAlias('/v1/functions/:functionId/deployments/:deploymentId/build/download', ['type' => 'output']) + ->groups(['api', 'functions']) + ->desc('Get deployment download') + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'deployments', + name: 'getDeploymentDownload', + description: <<<EOT + Get a function deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + EOT, + auth: [AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::ANY, + type: MethodType::LOCATION + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->param('type', 'source', new WhiteList(['source', 'output']), 'Deployment file to download. Can be: "source", "output".', true) + ->inject('response') + ->inject('request') + ->inject('dbForProject') + ->inject('deviceForFunctions') + ->inject('deviceForBuilds') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $deploymentId, + string $type, + Response $response, + Request $request, + Database $dbForProject, + Device $deviceForFunctions, + Device $deviceForBuilds + ) { + $function = $dbForProject->getDocument('functions', $functionId); + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if ($deployment->getAttribute('resourceId') !== $function->getId()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + switch ($type) { + case 'output': + $path = $deployment->getAttribute('buildPath', ''); + $device = $deviceForBuilds; + break; + case 'source': + $path = $deployment->getAttribute('sourcePath', ''); + $device = $deviceForFunctions; + break; + } + + if (!$device->exists($path)) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + $response + ->setContentType('application/gzip') + ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days + ->addHeader('X-Peak', \memory_get_peak_usage()) + ->addHeader('Content-Disposition', 'attachment; filename="' . $deploymentId . '.tar.gz"'); + + $size = $device->getFileSize($path); + $rangeHeader = $request->getHeader('range'); + + if (!empty($rangeHeader)) { + $start = $request->getRangeStart(); + $end = $request->getRangeEnd(); + $unit = $request->getRangeUnit(); + + if ($end === null) { + $end = min(($start + MAX_OUTPUT_CHUNK_SIZE - 1), ($size - 1)); + } + + if ($unit !== 'bytes' || $start >= $end || $end >= $size) { + throw new Exception(Exception::STORAGE_INVALID_RANGE); + } + + $response + ->addHeader('Accept-Ranges', 'bytes') + ->addHeader('Content-Range', 'bytes ' . $start . '-' . $end . '/' . $size) + ->addHeader('Content-Length', $end - $start + 1) + ->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT); + + $response->send($device->read($path, $start, ($end - $start + 1))); + } + + if ($size > APP_STORAGE_READ_BUFFER) { + for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) { + $response->chunk( + $device->read( + $path, + ($i * MAX_OUTPUT_CHUNK_SIZE), + min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE)) + ), + (($i + 1) * MAX_OUTPUT_CHUNK_SIZE) >= $size + ); + } + } else { + $response->send($device->read($path)); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php new file mode 100644 index 0000000000..8f739dd37f --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Duplicate/Create.php @@ -0,0 +1,136 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Duplicate; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Storage\Device; + +class Create extends Action +{ + use HTTP; + + public static function getName() + { + return 'createDuplicateDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/functions/:functionId/deployments/duplicate') + ->httpAlias('/v1/functions/:functionId/deployments/:deploymentId/build') + ->httpAlias('/v1/functions/:functionId/deployments/:deploymentId/builds/:buildId') + ->desc('Create duplicate deployment') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('event', 'functions.[functionId].deployments.[deploymentId].update') + ->label('audits.event', 'deployment.update') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'deployments', + name: 'createDuplicateDeployment', + description: <<<EOT + Create a new build for an existing function deployment. This endpoint allows you to rebuild a deployment with the updated function configuration, including its entrypoint and build commands if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_ACCEPTED, + model: Response::MODEL_DEPLOYMENT, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->param('buildId', '', new UID(), 'Build unique ID.', true) // added as optional param for backward compatibility + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->inject('queueForBuilds') + ->inject('deviceForFunctions') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $deploymentId, + string $buildId, + Response $response, + Database $dbForProject, + Event $queueForEvents, + Build $queueForBuilds, + Device $deviceForFunctions + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + $path = $deployment->getAttribute('sourcePath'); + if (empty($path) || !$deviceForFunctions->exists($path)) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + $deploymentId = ID::unique(); + + $destination = $deviceForFunctions->getPath($deploymentId . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION)); + $deviceForFunctions->transfer($path, $destination, $deviceForFunctions); + + $deployment->removeAttribute('$internalId'); + $deployment = $dbForProject->createDocument('deployments', $deployment->setAttributes([ + '$internalId' => '', + '$id' => $deploymentId, + 'sourcePath' => $destination, + 'totalSize' => $deployment->getAttribute('sourceSize', 0), + 'entrypoint' => $function->getAttribute('entrypoint'), + 'buildCommands' => $function->getAttribute('commands', ''), + 'buildStartedAt' => null, + 'buildEndedAt' => null, + 'buildDuration' => null, + 'buildSize' => null, + 'status' => 'waiting', + 'buildPath' => '', + 'buildLogs' => '', + ])); + + $function = $function + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('functions', $function->getId(), $function); + + $queueForBuilds + ->setType(BUILD_TYPE_DEPLOYMENT) + ->setResource($function) + ->setDeployment($deployment); + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php new file mode 100644 index 0000000000..e9c5240f5c --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Get.php @@ -0,0 +1,79 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Deployments; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Action +{ + use HTTP; + + public static function getName() + { + return 'getDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/:functionId/deployments/:deploymentId') + ->desc('Get deployment') + ->groups(['api', 'functions']) + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'deployments', + name: 'getDeployment', + description: <<<EOT + Get a function deployment by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_DEPLOYMENT, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $deploymentId, + Response $response, + Database $dbForProject + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if ($deployment->getAttribute('resourceId') !== $function->getId()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + $response->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php new file mode 100644 index 0000000000..c5436d1d05 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Status/Update.php @@ -0,0 +1,120 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Status; + +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Executor\Executor; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Document; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Update extends Action +{ + use HTTP; + + public static function getName() + { + return 'updateDeploymentStatus'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpPath('/v1/functions/:functionId/deployments/:deploymentId/status') + ->httpAlias('/v1/functions/:functionId/deployments/:deploymentId/build') + ->desc('Update deployment status') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('audits.event', 'deployment.update') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'deployments', + name: 'updateDeploymentStatus', + description: <<<EOT + Cancel an ongoing function deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_DEPLOYMENT, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('project') + ->inject('queueForEvents') + ->inject('executor') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $deploymentId, + Response $response, + Database $dbForProject, + Document $project, + Event $queueForEvents, + Executor $executor + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if (\in_array($deployment->getAttribute('status'), ['ready', 'failed'])) { + throw new Exception(Exception::BUILD_ALREADY_COMPLETED); + } + + $startTime = new \DateTime($deployment->getAttribute('buildStartedAt', 'now')); + $endTime = new \DateTime('now'); + $duration = $endTime->getTimestamp() - $startTime->getTimestamp(); + + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment->setAttributes([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' + ])); + + if ($deployment->getInternalId() === $function->getAttribute('latestDeploymentInternalId', '')) { + $function = $function->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('functions', $function->getId(), $function); + } + + try { + $executor->deleteRuntime($project->getId(), $deploymentId . "-build"); + } catch (\Throwable $th) { + // Don't throw if the deployment doesn't exist + if ($th->getCode() !== 404) { + throw $th; + } + } + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php new file mode 100644 index 0000000000..55230bd4a5 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Template/Create.php @@ -0,0 +1,174 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Template; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Swoole\Request; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; +use Utopia\VCS\Adapter\Git\GitHub; + +class Create extends Base +{ + use HTTP; + + public static function getName() + { + return 'createTemplateDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/functions/:functionId/deployments/template') + ->desc('Create template deployment') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('event', 'functions.[functionId].deployments.[deploymentId].create') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('audits.event', 'deployment.create') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'deployments', + name: 'createTemplateDeployment', + description: <<<EOT + Create a deployment based on a template. + + Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to find the template details. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_ACCEPTED, + model: Response::MODEL_DEPLOYMENT, + ) + ], + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('repository', '', new Text(128, 0), 'Repository name of the template.') + ->param('owner', '', new Text(128, 0), 'The name of the owner of the template.') + ->param('rootDirectory', '', new Text(128, 0), 'Path to function code in the template repo.') + ->param('version', '', new Text(128, 0), 'Version (tag) for the repo linked to the function template.') + ->param('activate', false, new Boolean(), 'Automatically activate the deployment when it is finished building.', true) + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('queueForEvents') + ->inject('project') + ->inject('queueForBuilds') + ->inject('gitHub') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $repository, + string $owner, + string $rootDirectory, + string $version, + bool $activate, + Request $request, + Response $response, + Database $dbForProject, + Database $dbForPlatform, + Event $queueForEvents, + Document $project, + Build $queueForBuilds, + GitHub $github + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $template = new Document([ + 'repositoryName' => $repository, + 'ownerName' => $owner, + 'rootDirectory' => $rootDirectory, + 'version' => $version + ]); + + if (!empty($function->getAttribute('providerRepositoryId'))) { + $installation = $dbForPlatform->getDocument('installations', $function->getAttribute('installationId')); + + $deployment = $this->redeployVcsFunction( + request: $request, + function: $function, + project: $project, + installation: $installation, + dbForProject: $dbForProject, + queueForBuilds: $queueForBuilds, + template: $template, + github: $github, + activate: $activate + ); + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + + return; + } + + $deploymentId = ID::unique(); + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceId' => $function->getId(), + 'resourceInternalId' => $function->getInternalId(), + 'resourceType' => 'functions', + 'entrypoint' => $function->getAttribute('entrypoint', ''), + 'buildCommands' => $function->getAttribute('commands', ''), + 'type' => 'manual', + 'activate' => $activate, + ])); + + $function = $function + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('functions', $function->getId(), $function); + + $queueForBuilds + ->setType(BUILD_TYPE_DEPLOYMENT) + ->setResource($function) + ->setDeployment($deployment) + ->setTemplate($template); + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php new file mode 100644 index 0000000000..48f3894bb2 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/Vcs/Create.php @@ -0,0 +1,124 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Deployments\Vcs; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Swoole\Request; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; +use Utopia\Validator\WhiteList; +use Utopia\VCS\Adapter\Git\GitHub; + +class Create extends Base +{ + use HTTP; + + public static function getName() + { + return 'createVcsDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/functions/:functionId/deployments/vcs') + ->desc('Create VCS deployment') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('event', 'functions.[functionId].deployments.[deploymentId].create') + ->label('audits.event', 'deployment.create') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'deployments', + name: 'createVcsDeployment', + description: <<<EOT + Create a deployment when a function is connected to VCS. + + This endpoint lets you create deployment from a branch, commit, or a tag. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_ACCEPTED, + model: Response::MODEL_DEPLOYMENT, + ) + ], + )) + ->param('functionId', '', new UID(), 'Function ID.') + // TODO: Support tag in future + ->param('type', '', new WhiteList(['branch', 'commit']), 'Type of reference passed. Allowed values are: branch, commit') + ->param('reference', '', new Text(255), 'VCS reference to create deployment from. Depending on type this can be: branch name, commit hash') + ->param('activate', false, new Boolean(), 'Automatically activate the deployment when it is finished building.', true) + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('project') + ->inject('queueForEvents') + ->inject('queueForBuilds') + ->inject('gitHub') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $type, + string $reference, + bool $activate, + Request $request, + Response $response, + Database $dbForProject, + Database $dbForPlatform, + Document $project, + Event $queueForEvents, + Build $queueForBuilds, + GitHub $github + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $template = new Document(); + + $installation = $dbForPlatform->getDocument('installations', $function->getAttribute('installationId')); + + $deployment = $this->redeployVcsFunction( + request: $request, + function: $function, + project: $project, + installation: $installation, + dbForProject: $dbForProject, + queueForBuilds: $queueForBuilds, + template: $template, + github: $github, + activate: $activate, + reference: $reference, + referenceType: $type + ); + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php new file mode 100644 index 0000000000..38f1f38e89 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Deployments/XList.php @@ -0,0 +1,129 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Deployments; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\Queries\Deployments; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Order as OrderException; +use Utopia\Database\Exception\Query as QueryException; +use Utopia\Database\Query; +use Utopia\Database\Validator\Query\Cursor; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Text; + +class XList extends Action +{ + use HTTP; + + public static function getName() + { + return 'listDeployments'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/:functionId/deployments') + ->desc('List deployments') + ->groups(['api', 'functions']) + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'deployments', + name: 'listDeployments', + description: <<<EOT + Get a list of all the function's code deployments. You can use the query params to filter your results. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_DEPLOYMENT_LIST, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('queries', [], new Deployments(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Deployments::ALLOWED_ATTRIBUTES), true) + ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + array $queries, + string $search, + Response $response, + Database $dbForProject + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + if (!empty($search)) { + $queries[] = Query::search('search', $search); + } + + // Set resource queries + $queries[] = Query::equal('resourceInternalId', [$function->getInternalId()]); + $queries[] = Query::equal('resourceType', ['functions']); + + /** + * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries + */ + $cursor = \array_filter($queries, function ($query) { + return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); + }); + $cursor = reset($cursor); + if ($cursor) { + /** @var Query $cursor */ + + $validator = new Cursor(); + if (!$validator->isValid($cursor)) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); + } + + $deploymentId = $cursor->getValue(); + $cursorDocument = $dbForProject->getDocument('deployments', $deploymentId); + + if ($cursorDocument->isEmpty()) { + throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Deployment '{$deploymentId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + + try { + $results = $dbForProject->find('deployments', $queries); + $total = $dbForProject->count('deployments', $filterQueries, APP_LIMIT_COUNT); + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } + + $response->dynamic(new Document([ + 'deployments' => $results, + 'total' => $total, + ]), Response::MODEL_DEPLOYMENT_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php new file mode 100644 index 0000000000..fd1b2076a8 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Create.php @@ -0,0 +1,477 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Executions; + +use Ahc\Jwt\JWT; +use Appwrite\Auth\Auth; +use Appwrite\Event\Event; +use Appwrite\Event\Func; +use Appwrite\Event\StatsUsage; +use Appwrite\Extend\Exception; +use Appwrite\Extend\Exception as AppwriteException; +use Appwrite\Functions\Validator\Headers; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Tasks\ScheduleExecutions; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Executor\Executor; +use MaxMind\Db\Reader; +use Utopia\CLI\Console; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\Datetime as DatetimeValidator; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Swoole\Request; +use Utopia\System\System; +use Utopia\Validator\AnyOf; +use Utopia\Validator\Assoc; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; +use Utopia\Validator\WhiteList; + +class Create extends Base +{ + use HTTP; + + public static function getName() + { + return 'createExecution'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/functions/:functionId/executions') + ->desc('Create execution') + ->groups(['api', 'functions']) + ->label('scope', 'execution.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('event', 'functions.[functionId].executions.[executionId].create') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'executions', + name: 'createExecution', + description: <<<EOT + Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously. + EOT, + auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_EXECUTION, + ) + ], + contentType: ContentType::MULTIPART, + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('body', '', new Text(10485760, 0), 'HTTP body of execution. Default value is empty string.', true) + ->param('async', false, new Boolean(true), 'Execute code in the background. Default value is false.', true) + ->param('path', '/', new Text(2048), 'HTTP path of execution. Path can include query params. Default value is /', true) + ->param('method', 'POST', new Whitelist(['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], true), 'HTTP method of execution. Default value is GET.', true) + ->param('headers', [], new AnyOf([new Assoc(), new Text(65535)], AnyOf::TYPE_MIXED), 'HTTP headers of execution. Defaults to empty.', true) + ->param('scheduledAt', null, new DatetimeValidator(requireDateInFuture: true, precision: DateTimeValidator::PRECISION_MINUTES, offset: 60), 'Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.', true) + ->inject('response') + ->inject('request') + ->inject('project') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('user') + ->inject('queueForEvents') + ->inject('queueForStatsUsage') + ->inject('queueForFunctions') + ->inject('geodb') + ->inject('executor') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $body, + mixed $async, + string $path, + string $method, + mixed $headers, + ?string $scheduledAt, + Response $response, + Request $request, + Document $project, + Database $dbForProject, + Database $dbForPlatform, + Document $user, + Event $queueForEvents, + StatsUsage $queueForStatsUsage, + Func $queueForFunctions, + Reader $geodb, + Executor $executor + ) { + $async = \strval($async) === 'true' || \strval($async) === '1'; + + if (!$async && !is_null($scheduledAt)) { + throw new Exception(Exception::GENERAL_BAD_REQUEST, 'Scheduled executions must run asynchronously. Set scheduledAt to a future date, or set async to true.'); + } + + /** + * @var array<string, mixed> $headers + */ + $assocParams = ['headers']; + foreach ($assocParams as $assocParam) { + if (!empty('headers') && !is_array($$assocParam)) { + $$assocParam = \json_decode($$assocParam, true); + } + } + + $booleanParams = ['async']; + foreach ($booleanParams as $booleamParam) { + if (!empty($$booleamParam) && !is_bool($$booleamParam)) { + $$booleamParam = $$booleamParam === "true" ? true : false; + } + } + + // 'headers' validator + $validator = new Headers(); + if (!$validator->isValid($headers)) { + throw new Exception($validator->getDescription(), 400); + } + + $function = Authorization::skip(fn () => $dbForProject->getDocument('functions', $functionId)); + + $isAPIKey = Auth::isAppUser(Authorization::getRoles()); + $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); + + if ($function->isEmpty() || (!$function->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $version = $function->getAttribute('version', 'v2'); + $runtimes = Config::getParam($version === 'v2' ? 'runtimes-v2' : 'runtimes', []); + $spec = Config::getParam('specifications')[$function->getAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT)]; + + $runtime = (isset($runtimes[$function->getAttribute('runtime', '')])) ? $runtimes[$function->getAttribute('runtime', '')] : null; + + if (\is_null($runtime)) { + throw new Exception(Exception::FUNCTION_RUNTIME_UNSUPPORTED, 'Runtime "' . $function->getAttribute('runtime', '') . '" is not supported'); + } + + $deployment = Authorization::skip(fn () => $dbForProject->getDocument('deployments', $function->getAttribute('deploymentId', ''))); + + if ($deployment->getAttribute('resourceId') !== $function->getId()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND, 'Deployment not found. Create a deployment before trying to execute a function'); + } + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND, 'Deployment not found. Create a deployment before trying to execute a function'); + } + + if ($deployment->getAttribute('status') !== 'ready') { + throw new Exception(Exception::BUILD_NOT_READY); + } + + $validator = new Authorization('execute'); + + if (!$validator->isValid($function->getAttribute('execute'))) { // Check if user has write access to execute function + throw new Exception(Exception::USER_UNAUTHORIZED, $validator->getDescription()); + } + + $jwt = ''; // initialize + if (!$user->isEmpty()) { // If userId exists, generate a JWT for function + $sessions = $user->getAttribute('sessions', []); + $current = new Document(); + + foreach ($sessions as $session) { + /** @var Utopia\Database\Document $session */ + if ($session->getAttribute('secret') == Auth::hash(Auth::$secret)) { // If current session delete the cookies too + $current = $session; + } + } + + if (!$current->isEmpty()) { + $jwtExpiry = $function->getAttribute('timeout', 900); + $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', $jwtExpiry, 0); + $jwt = $jwtObj->encode([ + 'userId' => $user->getId(), + 'sessionId' => $current->getId(), + ]); + } + } + + $jwtExpiry = $function->getAttribute('timeout', 900); + $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', $jwtExpiry, 0); + $apiKey = $jwtObj->encode([ + 'projectId' => $project->getId(), + 'scopes' => $function->getAttribute('scopes', []) + ]); + + $headers['x-appwrite-key'] = API_KEY_DYNAMIC . '_' . $apiKey; + $headers['x-appwrite-trigger'] = 'http'; + $headers['x-appwrite-user-id'] = $user->getId() ?? ''; + $headers['x-appwrite-user-jwt'] = $jwt ?? ''; + $headers['x-appwrite-country-code'] = ''; + $headers['x-appwrite-continent-code'] = ''; + $headers['x-appwrite-continent-eu'] = 'false'; + + $ip = $headers['x-real-ip'] ?? ''; + if (!empty($ip)) { + $record = $geodb->get($ip); + + if ($record) { + $eu = Config::getParam('locale-eu'); + + $headers['x-appwrite-country-code'] = $record['country']['iso_code'] ?? ''; + $headers['x-appwrite-continent-code'] = $record['continent']['code'] ?? ''; + $headers['x-appwrite-continent-eu'] = (\in_array($record['country']['iso_code'], $eu)) ? 'true' : 'false'; + } + } + + $headersFiltered = []; + foreach ($headers as $key => $value) { + if (\in_array(\strtolower($key), FUNCTION_ALLOWLIST_HEADERS_REQUEST)) { + $headersFiltered[] = ['name' => $key, 'value' => $value]; + } + } + + $executionId = ID::unique(); + + $status = $async ? 'waiting' : 'processing'; + + if (!is_null($scheduledAt)) { + $status = 'scheduled'; + } + + $execution = new Document([ + '$id' => $executionId, + '$permissions' => !$user->isEmpty() ? [Permission::read(Role::user($user->getId()))] : [], + 'resourceInternalId' => $function->getInternalId(), + 'resourceId' => $function->getId(), + 'resourceType' => 'functions', + 'deploymentInternalId' => $deployment->getInternalId(), + 'deploymentId' => $deployment->getId(), + 'trigger' => (!is_null($scheduledAt)) ? 'schedule' : 'http', + 'status' => $status, // waiting / processing / completed / failed / scheduled + 'responseStatusCode' => 0, + 'responseHeaders' => [], + 'requestPath' => $path, + 'requestMethod' => $method, + 'requestHeaders' => $headersFiltered, + 'errors' => '', + 'logs' => '', + 'duration' => 0.0, + ]); + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('executionId', $execution->getId()) + ->setContext('function', $function); + + if ($async) { + if (is_null($scheduledAt)) { + $execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution)); + $queueForFunctions + ->setType('http') + ->setExecution($execution) + ->setFunction($function) + ->setBody($body) + ->setHeaders($headers) + ->setPath($path) + ->setMethod($method) + ->setJWT($jwt) + ->setProject($project) + ->setUser($user) + ->setParam('functionId', $function->getId()) + ->setParam('executionId', $execution->getId()) + ->trigger(); + } else { + $data = [ + 'headers' => $headers, + 'path' => $path, + 'method' => $method, + 'body' => $body, + 'userId' => $user->getId() + ]; + + $schedule = $dbForPlatform->createDocument('schedules', new Document([ + 'region' => $project->getAttribute('region'), + 'resourceType' => ScheduleExecutions::getSupportedResource(), + 'resourceId' => $execution->getId(), + 'resourceInternalId' => $execution->getInternalId(), + 'resourceUpdatedAt' => DateTime::now(), + 'projectId' => $project->getId(), + 'schedule' => $scheduledAt, + 'data' => $data, + 'active' => true, + ])); + + $execution = $execution + ->setAttribute('scheduleId', $schedule->getId()) + ->setAttribute('scheduleInternalId', $schedule->getInternalId()) + ->setAttribute('scheduledAt', $scheduledAt); + + $execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution)); + } + + return $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($execution, Response::MODEL_EXECUTION); + } + + $durationStart = \microtime(true); + + $vars = []; + + // V2 vars + if ($version === 'v2') { + $vars = \array_merge($vars, [ + 'APPWRITE_FUNCTION_TRIGGER' => $headers['x-appwrite-trigger'] ?? '', + 'APPWRITE_FUNCTION_DATA' => $body ?? '', + 'APPWRITE_FUNCTION_USER_ID' => $headers['x-appwrite-user-id'] ?? '', + 'APPWRITE_FUNCTION_JWT' => $headers['x-appwrite-user-jwt'] ?? '' + ]); + } + + // Shared vars + foreach ($function->getAttribute('varsProject', []) as $var) { + $vars[$var->getAttribute('key')] = $var->getAttribute('value', ''); + } + + // Function vars + foreach ($function->getAttribute('vars', []) as $var) { + $vars[$var->getAttribute('key')] = $var->getAttribute('value', ''); + } + + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $hostname = System::getEnv('_APP_DOMAIN'); + $endpoint = $protocol . '://' . $hostname . "/v1"; + + // Appwrite vars + $vars = \array_merge($vars, [ + 'APPWRITE_FUNCTION_API_ENDPOINT' => $endpoint, + 'APPWRITE_FUNCTION_ID' => $functionId, + 'APPWRITE_FUNCTION_NAME' => $function->getAttribute('name'), + 'APPWRITE_FUNCTION_DEPLOYMENT' => $deployment->getId(), + 'APPWRITE_FUNCTION_PROJECT_ID' => $project->getId(), + 'APPWRITE_FUNCTION_RUNTIME_NAME' => $runtime['name'] ?? '', + 'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'] ?? '', + 'APPWRITE_FUNCTION_CPUS' => $spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT, + 'APPWRITE_FUNCTION_MEMORY' => $spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT, + 'APPWRITE_VERSION' => APP_VERSION_STABLE, + 'APPWRITE_REGION' => $project->getAttribute('region'), + 'APPWRITE_DEPLOYMENT_TYPE' => $deployment->getAttribute('type', ''), + 'APPWRITE_VCS_REPOSITORY_ID' => $deployment->getAttribute('providerRepositoryId', ''), + 'APPWRITE_VCS_REPOSITORY_NAME' => $deployment->getAttribute('providerRepositoryName', ''), + 'APPWRITE_VCS_REPOSITORY_OWNER' => $deployment->getAttribute('providerRepositoryOwner', ''), + 'APPWRITE_VCS_REPOSITORY_URL' => $deployment->getAttribute('providerRepositoryUrl', ''), + 'APPWRITE_VCS_REPOSITORY_BRANCH' => $deployment->getAttribute('providerBranch', ''), + 'APPWRITE_VCS_REPOSITORY_BRANCH_URL' => $deployment->getAttribute('providerBranchUrl', ''), + 'APPWRITE_VCS_COMMIT_HASH' => $deployment->getAttribute('providerCommitHash', ''), + 'APPWRITE_VCS_COMMIT_MESSAGE' => $deployment->getAttribute('providerCommitMessage', ''), + 'APPWRITE_VCS_COMMIT_URL' => $deployment->getAttribute('providerCommitUrl', ''), + 'APPWRITE_VCS_COMMIT_AUTHOR_NAME' => $deployment->getAttribute('providerCommitAuthor', ''), + 'APPWRITE_VCS_COMMIT_AUTHOR_URL' => $deployment->getAttribute('providerCommitAuthorUrl', ''), + 'APPWRITE_VCS_ROOT_DIRECTORY' => $deployment->getAttribute('providerRootDirectory', ''), + ]); + + /** Execute function */ + try { + $version = $function->getAttribute('version', 'v2'); + $command = $runtime['startCommand']; + $command = $version === 'v2' ? '' : 'cp /tmp/code.tar.gz /mnt/code/code.tar.gz && nohup helpers/start.sh "' . $command . '"'; + $executionResponse = $executor->createExecution( + projectId: $project->getId(), + deploymentId: $deployment->getId(), + body: \strlen($body) > 0 ? $body : null, + variables: $vars, + timeout: $function->getAttribute('timeout', 0), + image: $runtime['image'], + source: $deployment->getAttribute('buildPath', ''), + entrypoint: $deployment->getAttribute('entrypoint', ''), + version: $version, + path: $path, + method: $method, + headers: $headers, + runtimeEntrypoint: $command, + cpus: $spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT, + memory: $spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT, + logging: $function->getAttribute('logging', true), + requestTimeout: 30 + ); + + $headersFiltered = []; + foreach ($executionResponse['headers'] as $key => $value) { + if (\in_array(\strtolower($key), FUNCTION_ALLOWLIST_HEADERS_RESPONSE)) { + $headersFiltered[] = ['name' => $key, 'value' => $value]; + } + } + + /** Update execution status */ + $status = $executionResponse['statusCode'] >= 500 ? 'failed' : 'completed'; + $execution->setAttribute('status', $status); + $execution->setAttribute('responseStatusCode', $executionResponse['statusCode']); + $execution->setAttribute('responseHeaders', $headersFiltered); + $execution->setAttribute('logs', $executionResponse['logs']); + $execution->setAttribute('errors', $executionResponse['errors']); + $execution->setAttribute('duration', $executionResponse['duration']); + } catch (\Throwable $th) { + $durationEnd = \microtime(true); + + $execution + ->setAttribute('duration', $durationEnd - $durationStart) + ->setAttribute('status', 'failed') + ->setAttribute('responseStatusCode', 500) + ->setAttribute('errors', $th->getMessage() . '\nError Code: ' . $th->getCode()); + Console::error($th->getMessage()); + + if ($th instanceof AppwriteException) { + throw $th; + } + } finally { + $queueForStatsUsage + ->addMetric(METRIC_EXECUTIONS, 1) + ->addMetric(str_replace(['{resourceType}'], [RESOURCE_TYPE_FUNCTIONS], METRIC_RESOURCE_TYPE_EXECUTIONS), 1) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS), 1) + ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($execution->getAttribute('duration') * 1000)) // per project + ->addMetric(str_replace(['{resourceType}'], [RESOURCE_TYPE_FUNCTIONS], METRIC_RESOURCE_TYPE_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) // per function + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) // per function + ->addMetric(METRIC_EXECUTIONS_MB_SECONDS, (int)(($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT) * $execution->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT))) + ->addMetric(str_replace(['{resourceType}'], [RESOURCE_TYPE_FUNCTIONS], METRIC_RESOURCE_TYPE_EXECUTIONS_MB_SECONDS), (int)(($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT) * $execution->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT))) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_MB_SECONDS), (int)(($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT) * $execution->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT))) + ; + + $execution = Authorization::skip(fn () => $dbForProject->createDocument('executions', $execution)); + } + + $headers = []; + foreach (($executionResponse['headers'] ?? []) as $key => $value) { + $headers[] = ['name' => $key, 'value' => $value]; + } + + $execution->setAttribute('responseBody', $executionResponse['body'] ?? ''); + $execution->setAttribute('responseHeaders', $headers); + + $acceptTypes = \explode(', ', $request->getHeader('accept')); + foreach ($acceptTypes as $acceptType) { + if (\str_starts_with($acceptType, 'application/json') || \str_starts_with($acceptType, 'application/*')) { + $response->setContentType(Response::CONTENT_TYPE_JSON); + break; + } elseif (\str_starts_with($acceptType, 'multipart/form-data') || \str_starts_with($acceptType, 'multipart/*')) { + $response->setContentType(Response::CONTENT_TYPE_MULTIPART); + break; + } + } + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($execution, Response::MODEL_EXECUTION); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php new file mode 100644 index 0000000000..cd85b5e534 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Delete.php @@ -0,0 +1,123 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Executions; + +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Tasks\ScheduleExecutions; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Delete extends Base +{ + use HTTP; + + public static function getName() + { + return 'deleteExecution'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/functions/:functionId/executions/:executionId') + ->desc('Delete execution') + ->groups(['api', 'functions']) + ->label('scope', 'execution.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('event', 'functions.[functionId].executions.[executionId].delete') + ->label('audits.event', 'executions.delete') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'executions', + name: 'deleteExecution', + description: <<<EOT + Delete a function execution by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('executionId', '', new UID(), 'Execution ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('queueForEvents') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $executionId, + Response $response, + Database $dbForProject, + Database $dbForPlatform, + Event $queueForEvents + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $execution = $dbForProject->getDocument('executions', $executionId); + if ($execution->isEmpty()) { + throw new Exception(Exception::EXECUTION_NOT_FOUND); + } + + if ($execution->getAttribute('resourceType') !== 'functions' && $execution->getAttribute('resourceInternalId') !== $function->getInternalId()) { + throw new Exception(Exception::EXECUTION_NOT_FOUND); + } + $status = $execution->getAttribute('status'); + + if (!in_array($status, ['completed', 'failed', 'scheduled'])) { + throw new Exception(Exception::EXECUTION_IN_PROGRESS); + } + + if (!$dbForProject->deleteDocument('executions', $execution->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove execution from DB'); + } + + if ($status === 'scheduled') { + $schedule = $dbForPlatform->findOne('schedules', [ + Query::equal('resourceId', [$execution->getId()]), + Query::equal('resourceType', [ScheduleExecutions::getSupportedResource()]), + Query::equal('active', [true]), + ]); + + if (!$schedule->isEmpty()) { + $schedule + ->setAttribute('resourceUpdatedAt', DateTime::now()) + ->setAttribute('active', false); + + Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); + } + } + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('executionId', $execution->getId()) + ->setPayload($response->output($execution, Response::MODEL_EXECUTION)); + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php new file mode 100644 index 0000000000..892ce30f47 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/Get.php @@ -0,0 +1,85 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Executions; + +use Appwrite\Auth\Auth; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getExecution'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/:functionId/executions/:executionId') + ->desc('Get execution') + ->groups(['api', 'functions']) + ->label('scope', 'execution.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'executions', + name: 'getExecution', + description: <<<EOT + Get a function execution log by its unique ID. + EOT, + auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_EXECUTION, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('executionId', '', new UID(), 'Execution ID.') + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $executionId, + Response $response, + Database $dbForProject + ) { + $function = Authorization::skip(fn () => $dbForProject->getDocument('functions', $functionId)); + + $isAPIKey = Auth::isAppUser(Authorization::getRoles()); + $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); + + if ($function->isEmpty() || (!$function->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $execution = $dbForProject->getDocument('executions', $executionId); + + if ($execution->getAttribute('resourceType') !== 'functions' || $execution->getAttribute('resourceInternalId') !== $function->getInternalId()) { + throw new Exception(Exception::EXECUTION_NOT_FOUND); + } + + if ($execution->isEmpty()) { + throw new Exception(Exception::EXECUTION_NOT_FOUND); + } + + $response->dynamic($execution, Response::MODEL_EXECUTION); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php new file mode 100644 index 0000000000..a31e95b1c8 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Executions/XList.php @@ -0,0 +1,128 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Executions; + +use Appwrite\Auth\Auth; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\Queries\Executions; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Order as OrderException; +use Utopia\Database\Exception\Query as QueryException; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\Query\Cursor; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listExecutions'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/:functionId/executions') + ->desc('List executions') + ->groups(['api', 'functions']) + ->label('scope', 'execution.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'executions', + name: 'listExecutions', + description: <<<EOT + Get a list of all the current user function execution logs. You can use the query params to filter your results. + EOT, + auth: [AuthType::SESSION, AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_EXECUTION_LIST, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('queries', [], new Executions(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Executions::ALLOWED_ATTRIBUTES), true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + array $queries, + Response $response, + Database $dbForProject + ) { + $function = Authorization::skip(fn () => $dbForProject->getDocument('functions', $functionId)); + + $isAPIKey = Auth::isAppUser(Authorization::getRoles()); + $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); + + if ($function->isEmpty() || (!$function->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + // Set internal queries + $queries[] = Query::equal('resourceInternalId', [$function->getInternalId()]); + $queries[] = Query::equal('resourceType', ['functions']); + + /** + * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries + */ + $cursor = \array_filter($queries, function ($query) { + return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); + }); + $cursor = reset($cursor); + if ($cursor) { + /** @var Query $cursor */ + + $validator = new Cursor(); + if (!$validator->isValid($cursor)) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); + } + + $executionId = $cursor->getValue(); + $cursorDocument = $dbForProject->getDocument('executions', $executionId); + + if ($cursorDocument->isEmpty()) { + throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Execution '{$executionId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + + try { + $results = $dbForProject->find('executions', $queries); + $total = $dbForProject->count('executions', $filterQueries, APP_LIMIT_COUNT); + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } + + $response->dynamic(new Document([ + 'executions' => $results, + 'total' => $total, + ]), Response::MODEL_EXECUTION_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php new file mode 100644 index 0000000000..bc0f1b2dab --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Create.php @@ -0,0 +1,260 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Functions; + +use Appwrite\Event\Event; +use Appwrite\Event\Validator\FunctionEvent; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Validator\Specification; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Task\Validator\Cron; +use Appwrite\Utopia\Database\Validator\CustomId; +use Appwrite\Utopia\Response; +use Utopia\Abuse\Abuse; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\Roles; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\System\System; +use Utopia\Validator\ArrayList; +use Utopia\Validator\Boolean; +use Utopia\Validator\Range; +use Utopia\Validator\Text; +use Utopia\Validator\WhiteList; + +class Create extends Base +{ + use HTTP; + + public static function getName() + { + return 'createFunction'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/functions') + ->desc('Create function') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('event', 'functions.[functionId].create') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('audits.event', 'function.create') + ->label('audits.resource', 'function/{response.$id}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'functions', + name: 'create', + description: <<<EOT + Create a new function. You can pass a list of [permissions](https://appwrite.io/docs/permissions) to allow different project users or team with access to execute the function using the client API. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_FUNCTION, + ) + ], + )) + ->param('functionId', '', new CustomId(), 'Function ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('name', '', new Text(128), 'Function name. Max length: 128 chars.') + ->param('runtime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Execution runtime.') + ->param('execute', [], new Roles(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 64 characters long.', true) + ->param('events', [], new ArrayList(new FunctionEvent(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Events list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' events are allowed.', true) + ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true) + ->param('timeout', 15, new Range(1, (int) System::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)), 'Function maximum execution time in seconds.', true) + ->param('enabled', true, new Boolean(), 'Is function enabled? When set to \'disabled\', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.', true) + ->param('logging', true, new Boolean(), 'When disabled, executions will exclude logs and errors, and will be slightly faster.', true) + ->param('entrypoint', '', new Text(1028, 0), 'Entrypoint File. This path is relative to the "providerRootDirectory".', true) + ->param('commands', '', new Text(8192, 0), 'Build Commands.', true) + ->param('scopes', [], new ArrayList(new WhiteList(array_keys(Config::getParam('scopes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of scopes allowed for API key auto-generated for every execution. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' scopes are allowed.', true) + ->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for VCS (Version Control System) deployment.', true) + ->param('providerRepositoryId', '', new Text(128, 0), 'Repository ID of the repo linked to the function.', true) + ->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the function.', true) + ->param('providerSilentMode', false, new Boolean(), 'Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.', true) + ->param('providerRootDirectory', '', new Text(128, 0), 'Path to function code in the linked repo.', true) + ->param('specification', APP_COMPUTE_SPECIFICATION_DEFAULT, fn (array $plan) => new Specification( + $plan, + Config::getParam('specifications', []), + System::getEnv('_APP_COMPUTE_CPUS', 0), + System::getEnv('_APP_COMPUTE_MEMORY', 0) + ), 'Runtime specification for the function and builds.', true, ['plan']) + ->inject('response') + ->inject('dbForProject') + ->inject('timelimit') + ->inject('project') + ->inject('queueForEvents') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $name, + string $runtime, + array $execute, + array $events, + string $schedule, + int $timeout, + bool $enabled, + bool $logging, + string $entrypoint, + string $commands, + array $scopes, + string $installationId, + string $providerRepositoryId, + string $providerBranch, + bool $providerSilentMode, + string $providerRootDirectory, + string $specification, + Response $response, + Database $dbForProject, + callable $timelimit, + Document $project, + Event $queueForEvents, + Database $dbForPlatform + ) { + + // Temporary abuse check + $abuseCheck = function () use ($project, $timelimit, $response) { + $abuseKey = "projectId:{projectId},url:{url}"; + $abuseLimit = System::getEnv('_APP_FUNCTIONS_CREATION_ABUSE_LIMIT', 50); + $abuseTime = 86400; // 1 day + + $timeLimit = $timelimit($abuseKey, $abuseLimit, $abuseTime); + $timeLimit + ->setParam('{projectId}', $project->getId()) + ->setParam('{url}', '/v1/functions'); + + $abuse = new Abuse($timeLimit); + $remaining = $timeLimit->remaining(); + $limit = $timeLimit->limit(); + $time = $timeLimit->time() + $abuseTime; + + $response + ->addHeader('X-RateLimit-Limit', $limit) + ->addHeader('X-RateLimit-Remaining', $remaining) + ->addHeader('X-RateLimit-Reset', $time); + + $enabled = System::getEnv('_APP_OPTIONS_ABUSE', 'enabled') !== 'disabled'; + if ($enabled && $abuse->check()) { + throw new Exception(Exception::GENERAL_RATE_LIMIT_EXCEEDED); + } + }; + + $abuseCheck(); + + $functionId = ($functionId == 'unique()') ? ID::unique() : $functionId; + + $allowList = \array_filter(\explode(',', System::getEnv('_APP_FUNCTIONS_RUNTIMES', ''))); + + if (!empty($allowList) && !\in_array($runtime, $allowList)) { + throw new Exception(Exception::FUNCTION_RUNTIME_UNSUPPORTED, 'Runtime "' . $runtime . '" is not supported'); + } + + $installation = $dbForPlatform->getDocument('installations', $installationId); + + if (!empty($installationId) && $installation->isEmpty()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + + if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); + } + + $function = $dbForProject->createDocument('functions', new Document([ + '$id' => $functionId, + 'execute' => $execute, + 'enabled' => $enabled, + 'live' => true, + 'logging' => $logging, + 'name' => $name, + 'runtime' => $runtime, + 'deploymentInternalId' => '', + 'deploymentId' => '', + 'events' => $events, + 'schedule' => $schedule, + 'scheduleInternalId' => '', + 'scheduleId' => '', + 'timeout' => $timeout, + 'entrypoint' => $entrypoint, + 'commands' => $commands, + 'scopes' => $scopes, + 'search' => implode(' ', [$functionId, $name, $runtime]), + 'version' => 'v5', + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'repositoryId' => '', + 'repositoryInternalId' => '', + 'providerBranch' => $providerBranch, + 'providerRootDirectory' => $providerRootDirectory, + 'providerSilentMode' => $providerSilentMode, + 'specification' => $specification + ])); + + $schedule = Authorization::skip( + fn () => $dbForPlatform->createDocument('schedules', new Document([ + 'region' => $project->getAttribute('region'), + 'resourceType' => 'function', + 'resourceId' => $function->getId(), + 'resourceInternalId' => $function->getInternalId(), + 'resourceUpdatedAt' => DateTime::now(), + 'projectId' => $project->getId(), + 'schedule' => $function->getAttribute('schedule'), + 'active' => false, + ])) + ); + + $function->setAttribute('scheduleId', $schedule->getId()); + $function->setAttribute('scheduleInternalId', $schedule->getInternalId()); + + // Git connect logic + if (!empty($providerRepositoryId)) { + $teamId = $project->getAttribute('teamId', ''); + + $repository = $dbForPlatform->createDocument('repositories', new Document([ + '$id' => ID::unique(), + '$permissions' => [ + Permission::read(Role::team(ID::custom($teamId))), + Permission::update(Role::team(ID::custom($teamId), 'owner')), + Permission::update(Role::team(ID::custom($teamId), 'developer')), + Permission::delete(Role::team(ID::custom($teamId), 'owner')), + Permission::delete(Role::team(ID::custom($teamId), 'developer')), + ], + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'resourceId' => $function->getId(), + 'resourceInternalId' => $function->getInternalId(), + 'resourceType' => 'function', + 'providerPullRequestIds' => [] + ])); + + $function->setAttribute('repositoryId', $repository->getId()); + $function->setAttribute('repositoryInternalId', $repository->getInternalId()); + } + + $function = $dbForProject->updateDocument('functions', $function->getId(), $function); + + $queueForEvents->setParam('functionId', $function->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($function, Response::MODEL_FUNCTION); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php new file mode 100644 index 0000000000..91da68538c --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Delete.php @@ -0,0 +1,100 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Functions; + +use Appwrite\Event\Delete as DeleteEvent; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Delete extends Base +{ + use HTTP; + + public static function getName() + { + return 'deleteFunction'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/functions/:functionId') + ->desc('Delete function') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('event', 'functions.[functionId].delete') + ->label('audits.event', 'function.delete') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'functions', + name: 'delete', + description: <<<EOT + Delete a function by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForDeletes') + ->inject('queueForEvents') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + Response $response, + Database $dbForProject, + DeleteEvent $queueForDeletes, + Event $queueForEvents, + Database $dbForPlatform + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + if (!$dbForProject->deleteDocument('functions', $function->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove function from DB'); + } + + // Inform scheduler to no longer run function + $schedule = $dbForPlatform->getDocument('schedules', $function->getAttribute('scheduleId')); + $schedule + ->setAttribute('resourceUpdatedAt', DateTime::now()) + ->setAttribute('active', false); + Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); + + $queueForDeletes + ->setType(DELETE_TYPE_DOCUMENT) + ->setDocument($function); + + $queueForEvents->setParam('functionId', $function->getId()); + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php new file mode 100644 index 0000000000..6de71cfae6 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Deployment/Update.php @@ -0,0 +1,134 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Functions\Deployment; + +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Query; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Document; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Update extends Base +{ + use HTTP; + + public static function getName() + { + return 'updateFunctionDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpPath('/v1/functions/:functionId/deployment') + ->httpAlias('/v1/functions/:functionId/deployments/:deploymentId') + ->desc('Update function\'s deployment') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('event', 'functions.[functionId].deployments.[deploymentId].update') + ->label('audits.event', 'deployment.update') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'functions', + name: 'updateFunctionDeployment', + description: <<<EOT + Update the function active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your function. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_FUNCTION, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->inject('project') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $deploymentId, + Document $project, + Response $response, + Database $dbForProject, + Event $queueForEvents, + Database $dbForPlatform + ) { + $function = $dbForProject->getDocument('functions', $functionId); + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if ($deployment->getAttribute('status') !== 'ready') { + throw new Exception(Exception::BUILD_NOT_READY); + } + + $oldDeploymentInternalId = $function->getAttribute('deploymentInternalId', ''); + + $function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [ + 'deploymentInternalId' => $deployment->getInternalId(), + 'deploymentId' => $deployment->getId(), + 'deploymentCreatedAt' => $deployment->getCreatedAt(), + ]))); + + // Inform scheduler if function is still active + $schedule = $dbForPlatform->getDocument('schedules', $function->getAttribute('scheduleId')); + $schedule + ->setAttribute('resourceUpdatedAt', DateTime::now()) + ->setAttribute('schedule', $function->getAttribute('schedule')) + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); + Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); + + $queries = [ + Query::equal('trigger', 'manual'), + Query::equal("type", ["deployment"]), + Query::equal("deploymentResourceType", ["function"]), + Query::equal("deploymentResourceInternalId", [$function->getInternalId()]), + ]; + + if (empty($oldDeploymentInternalId)) { + $queries[] = Query::equal("deploymentInternalId", [""]); + } else { + $queries[] = Query::equal("deploymentInternalId", [$oldDeploymentInternalId]); + } + + $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { + $rule = $rule + ->setAttribute('deploymentId', $deployment->getId()) + ->setAttribute('deploymentInternalId', $deployment->getInternalId()); + $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + }); + + $queueForEvents + ->setParam('functionId', $function->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response->dynamic($function, Response::MODEL_FUNCTION); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php new file mode 100644 index 0000000000..9ce6560fd0 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Get.php @@ -0,0 +1,68 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Functions; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getFunction'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/:functionId') + ->desc('Get function') + ->groups(['api', 'functions']) + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'functions', + name: 'get', + description: <<<EOT + Get a function by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_FUNCTION, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + Response $response, + Database $dbForProject + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $response->dynamic($function, Response::MODEL_FUNCTION); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php new file mode 100644 index 0000000000..a19ec1e278 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/Update.php @@ -0,0 +1,291 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Functions; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Event\Validator\FunctionEvent; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Validator\Specification; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Task\Validator\Cron; +use Appwrite\Utopia\Response; +use Executor\Executor; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\Roles; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Swoole\Request; +use Utopia\System\System; +use Utopia\Validator\ArrayList; +use Utopia\Validator\Boolean; +use Utopia\Validator\Nullable; +use Utopia\Validator\Range; +use Utopia\Validator\Text; +use Utopia\Validator\WhiteList; +use Utopia\VCS\Adapter\Git\GitHub; + +class Update extends Base +{ + use HTTP; + + public static function getName() + { + return 'updateFunction'; + } + + public function __construct() + { + $this->setHttpMethod(Action::HTTP_REQUEST_METHOD_PUT) + ->setHttpPath('/v1/functions/:functionId') + ->desc('Update function') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('event', 'functions.[functionId].update') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('audits.event', 'function.update') + ->label('audits.resource', 'function/{response.$id}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'functions', + name: 'update', + description: <<<EOT + Update function by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_FUNCTION, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('name', '', new Text(128), 'Function name. Max length: 128 chars.') + ->param('runtime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Execution runtime.', true) + ->param('execute', [], new Roles(APP_LIMIT_ARRAY_PARAMS_SIZE), 'An array of role strings with execution permissions. By default no user is granted with any execute permissions. [learn more about roles](https://appwrite.io/docs/permissions#permission-roles). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' roles are allowed, each 64 characters long.', true) + ->param('events', [], new ArrayList(new FunctionEvent(), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Events list. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' events are allowed.', true) + ->param('schedule', '', new Cron(), 'Schedule CRON syntax.', true) + ->param('timeout', 15, new Range(1, (int) System::getEnv('_APP_FUNCTIONS_TIMEOUT', 900)), 'Maximum execution time in seconds.', true) + ->param('enabled', true, new Boolean(), 'Is function enabled? When set to \'disabled\', users cannot access the function but Server SDKs with and API key can still access the function. No data is lost when this is toggled.', true) + ->param('logging', true, new Boolean(), 'When disabled, executions will exclude logs and errors, and will be slightly faster.', true) + ->param('entrypoint', '', new Text(1028, 0), 'Entrypoint File. This path is relative to the "providerRootDirectory".', true) + ->param('commands', '', new Text(8192, 0), 'Build Commands.', true) + ->param('scopes', [], new ArrayList(new WhiteList(array_keys(Config::getParam('scopes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of scopes allowed for API Key auto-generated for every execution. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' scopes are allowed.', true) + ->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for VCS (Version Controle System) deployment.', true) + ->param('providerRepositoryId', null, new Nullable(new Text(128, 0)), 'Repository ID of the repo linked to the function', true) + ->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the function', true) + ->param('providerSilentMode', false, new Boolean(), 'Is the VCS (Version Control System) connection in silent mode for the repo linked to the function? In silent mode, comments will not be made on commits and pull requests.', true) + ->param('providerRootDirectory', '', new Text(128, 0), 'Path to function code in the linked repo.', true) + ->param('specification', APP_COMPUTE_SPECIFICATION_DEFAULT, fn (array $plan) => new Specification( + $plan, + Config::getParam('specifications', []), + System::getEnv('_APP_COMPUTE_CPUS', 0), + System::getEnv('_APP_COMPUTE_MEMORY', 0) + ), 'Runtime specification for the function and builds.', true, ['plan']) + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('project') + ->inject('queueForEvents') + ->inject('queueForBuilds') + ->inject('dbForPlatform') + ->inject('gitHub') + ->inject('executor') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $name, + string $runtime, + array $execute, + array $events, + string $schedule, + int $timeout, + bool $enabled, + bool $logging, + string $entrypoint, + string $commands, + array $scopes, + string $installationId, + ?string $providerRepositoryId, + string $providerBranch, + bool $providerSilentMode, + string $providerRootDirectory, + string $specification, + Request $request, + Response $response, + Database $dbForProject, + Document $project, + Event $queueForEvents, + Build $queueForBuilds, + Database $dbForPlatform, + GitHub $github, + Executor $executor + ) { + // TODO: If only branch changes, re-deploy + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $installation = $dbForPlatform->getDocument('installations', $installationId); + + if (!empty($installationId) && $installation->isEmpty()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + + if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); + } + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + if (empty($runtime)) { + $runtime = $function->getAttribute('runtime'); + } + + $enabled ??= $function->getAttribute('enabled', true); + + $repositoryId = $function->getAttribute('repositoryId', ''); + $repositoryInternalId = $function->getAttribute('repositoryInternalId', ''); + + if (empty($entrypoint)) { + $entrypoint = $function->getAttribute('entrypoint', ''); + } + + $isConnected = !empty($function->getAttribute('providerRepositoryId', '')); + + // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git + if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { + $repositories = $dbForPlatform->find('repositories', [ + Query::equal('projectInternalId', [$project->getInternalId()]), + Query::equal('resourceInternalId', [$function->getInternalId()]), + Query::equal('resourceType', ['function']), + Query::limit(100), + ]); + + foreach ($repositories as $repository) { + $dbForPlatform->deleteDocument('repositories', $repository->getId()); + } + + $providerRepositoryId = ''; + $installationId = ''; + $providerBranch = ''; + $providerRootDirectory = ''; + $providerSilentMode = true; + $repositoryId = ''; + $repositoryInternalId = ''; + } + + // Git connect logic + if (!$isConnected && !empty($providerRepositoryId)) { + $teamId = $project->getAttribute('teamId', ''); + + $repository = $dbForPlatform->createDocument('repositories', new Document([ + '$id' => ID::unique(), + '$permissions' => [ + Permission::read(Role::team(ID::custom($teamId))), + Permission::update(Role::team(ID::custom($teamId), 'owner')), + Permission::update(Role::team(ID::custom($teamId), 'developer')), + Permission::delete(Role::team(ID::custom($teamId), 'owner')), + Permission::delete(Role::team(ID::custom($teamId), 'developer')), + ], + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'resourceId' => $function->getId(), + 'resourceInternalId' => $function->getInternalId(), + 'resourceType' => 'function', + 'providerPullRequestIds' => [] + ])); + + $repositoryId = $repository->getId(); + $repositoryInternalId = $repository->getInternalId(); + } + + $live = true; + + if ( + $function->getAttribute('name') !== $name || + $function->getAttribute('entrypoint') !== $entrypoint || + $function->getAttribute('commands') !== $commands || + $function->getAttribute('providerRootDirectory') !== $providerRootDirectory || + $function->getAttribute('runtime') !== $runtime + ) { + $live = false; + } + + // Enforce Cold Start if spec limits change. + if ($function->getAttribute('specification') !== $specification && !empty($function->getAttribute('deploymentId'))) { + try { + $executor->deleteRuntime($project->getId(), $function->getAttribute('deploymentId')); + } catch (\Throwable $th) { + // Don't throw if the deployment doesn't exist + if ($th->getCode() !== 404) { + throw $th; + } + } + } + + $function = $dbForProject->updateDocument('functions', $function->getId(), new Document(array_merge($function->getArrayCopy(), [ + 'execute' => $execute, + 'name' => $name, + 'runtime' => $runtime, + 'events' => $events, + 'schedule' => $schedule, + 'timeout' => $timeout, + 'enabled' => $enabled, + 'live' => $live, + 'logging' => $logging, + 'entrypoint' => $entrypoint, + 'commands' => $commands, + 'scopes' => $scopes, + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'repositoryId' => $repositoryId, + 'repositoryInternalId' => $repositoryInternalId, + 'providerBranch' => $providerBranch, + 'providerRootDirectory' => $providerRootDirectory, + 'providerSilentMode' => $providerSilentMode, + 'specification' => $specification, + 'search' => implode(' ', [$functionId, $name, $runtime]), + ]))); + + // Redeploy logic + if (!$isConnected && !empty($providerRepositoryId)) { + $this->redeployVcsFunction($request, $function, $project, $installation, $dbForProject, $queueForBuilds, new Document(), $github, true); + } + + // Inform scheduler if function is still active + $schedule = $dbForPlatform->getDocument('schedules', $function->getAttribute('scheduleId')); + $schedule + ->setAttribute('resourceUpdatedAt', DateTime::now()) + ->setAttribute('schedule', $function->getAttribute('schedule')) + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); + Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); + + $queueForEvents->setParam('functionId', $function->getId()); + + $response->dynamic($function, Response::MODEL_FUNCTION); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php new file mode 100644 index 0000000000..cd0eba2c50 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Functions/XList.php @@ -0,0 +1,117 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Functions; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\Queries\Functions; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Order as OrderException; +use Utopia\Database\Exception\Query as QueryException; +use Utopia\Database\Query; +use Utopia\Database\Validator\Query\Cursor; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Text; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listFunctions'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions') + ->groups(['api', 'functions']) + ->desc('List functions') + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'functions', + name: 'list', + description: <<<EOT + Get a list of all the project's functions. You can use the query params to filter your results. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_FUNCTION_LIST, + ) + ] + )) + ->param('queries', [], new Functions(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Functions::ALLOWED_ATTRIBUTES), true) + ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action( + array $queries, + string $search, + Response $response, + Database $dbForProject + ) { + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + if (!empty($search)) { + $queries[] = Query::search('search', $search); + } + + /** + * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries + */ + $cursor = \array_filter($queries, function ($query) { + return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); + }); + $cursor = reset($cursor); + if ($cursor) { + /** @var Query $cursor */ + + $validator = new Cursor(); + if (!$validator->isValid($cursor)) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); + } + + $functionId = $cursor->getValue(); + $cursorDocument = $dbForProject->getDocument('functions', $functionId); + + if ($cursorDocument->isEmpty()) { + throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Function '{$functionId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + + try { + $functions = $dbForProject->find('functions', $queries); + $total = $dbForProject->count('functions', $filterQueries, APP_LIMIT_COUNT); + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } + + $response->dynamic(new Document([ + 'functions' => $functions, + 'total' => $total, + ]), Response::MODEL_FUNCTION_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php new file mode 100644 index 0000000000..bfccff0479 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Runtimes/XList.php @@ -0,0 +1,74 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Runtimes; + +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Document; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\System\System; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listRuntimes'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/runtimes') + ->groups(['api']) + ->desc('List runtimes') + ->label('scope', 'public') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'runtimes', + name: 'listRuntimes', + description: <<<EOT + Get a list of all runtimes that are currently active on your instance. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_RUNTIME_LIST, + ) + ] + )) + ->inject('response') + ->callback([$this, 'action']); + } + + public function action(Response $response) + { + $runtimes = Config::getParam('runtimes'); + + $allowList = \array_filter(\explode(',', System::getEnv('_APP_FUNCTIONS_RUNTIMES', ''))); + + $allowed = []; + foreach ($runtimes as $id => $runtime) { + if (!empty($allowList) && !\in_array($id, $allowList)) { + continue; + } + + $runtime['$id'] = $id; + $allowed[] = $runtime; + } + + $response->dynamic(new Document([ + 'total' => count($allowed), + 'runtimes' => $allowed + ]), Response::MODEL_RUNTIME_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php new file mode 100644 index 0000000000..39186e7ab7 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Specifications/XList.php @@ -0,0 +1,81 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Specifications; + +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Document; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\System\System; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listSpecifications'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/specifications') + ->groups(['api', 'functions']) + ->desc('List specifications') + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'runtimes', + name: 'listSpecifications', + description: <<<EOT + List allowed function specifications for this instance. + EOT, + auth: [AuthType::KEY, AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_SPECIFICATION_LIST, + ) + ] + )) + ->inject('response') + ->inject('plan') + ->callback([$this, 'action']); + } + + public function action(Response $response, array $plan) + { + $allSpecs = Config::getParam('specifications', []); + + $specs = []; + foreach ($allSpecs as $spec) { + $spec['enabled'] = true; + + if (array_key_exists('runtimeSpecifications', $plan)) { + $spec['enabled'] = in_array($spec['slug'], $plan['runtimeSpecifications']); + } + + $maxCpus = System::getEnv('_APP_FUNCTIONS_CPUS', 0); + $maxMemory = System::getEnv('_APP_FUNCTIONS_MEMORY', 0); + + // Only add specs that are within the limits set by environment variables + // Treat 0 as no limit + if ((empty($maxCpus) || $spec['cpus'] <= $maxCpus) && (empty($maxMemory) || $spec['memory'] <= $maxMemory)) { + $specs[] = $spec; + } + } + + $response->dynamic(new Document([ + 'specifications' => $specs, + 'total' => count($specs) + ]), Response::MODEL_SPECIFICATION_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php new file mode 100644 index 0000000000..237898f6fa --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Templates/Get.php @@ -0,0 +1,71 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Templates; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Document; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Text; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getTemplate'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/templates/:templateId') + ->desc('Get function template') + ->groups(['api', 'functions']) + ->label('scope', 'public') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'templates', + name: 'getTemplate', + description: <<<EOT + Get a function template using ID. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_TEMPLATE_FUNCTION, + ) + ] + )) + ->param('templateId', '', new Text(128), 'Template ID.') + ->inject('response') + ->callback([$this, 'action']); + } + + public function action(string $templateId, Response $response) + { + $templates = Config::getParam('templates-function', []); + + $filtered = \array_filter($templates, function ($template) use ($templateId) { + return $template['id'] === $templateId; + }); + + $template = array_shift($filtered); + + if (empty($template)) { + throw new Exception(Exception::FUNCTION_TEMPLATE_NOT_FOUND); + } + + $response->dynamic(new Document($template), Response::MODEL_TEMPLATE_FUNCTION); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php new file mode 100644 index 0000000000..05b54a75d0 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Templates/XList.php @@ -0,0 +1,86 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Templates; + +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Document; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\ArrayList; +use Utopia\Validator\Range; +use Utopia\Validator\WhiteList; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listTemplates'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/templates') + ->desc('List templates') + ->groups(['api']) + ->label('scope', 'public') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: 'templates', + name: 'listTemplates', + description: <<<EOT + List available function templates. You can use template details in [createFunction](/docs/references/cloud/server-nodejs/functions#create) method. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_TEMPLATE_FUNCTION_LIST, + ) + ] + )) + ->param('runtimes', [], new ArrayList(new WhiteList(array_keys(Config::getParam('runtimes')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of runtimes allowed for filtering function templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' runtimes are allowed.', true) + ->param('useCases', [], new ArrayList(new WhiteList(['dev-tools','starter','databases','ai','messaging','utilities']), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of use cases allowed for filtering function templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' use cases are allowed.', true) + ->param('limit', 25, new Range(1, 5000), 'Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.', true) + ->param('offset', 0, new Range(0, 5000), 'Offset the list of returned templates. Maximum offset is 5000.', true) + ->inject('response') + ->callback([$this, 'action']); + } + + public function action(array $runtimes, array $usecases, int $limit, int $offset, Response $response) + { + $templates = Config::getParam('templates-function', []); + + if (!empty($runtimes)) { + $templates = \array_filter($templates, function ($template) use ($runtimes) { + return \count(\array_intersect($runtimes, \array_column($template['runtimes'], 'name'))) > 0; + }); + } + + if (!empty($usecases)) { + $templates = \array_filter($templates, function ($template) use ($usecases) { + return \count(\array_intersect($usecases, $template['useCases'])) > 0; + }); + } + + \usort($templates, function ($a, $b) { + return $b['score'] <=> $a['score']; + }); + + $total = \count($templates); + $templates = \array_slice($templates, $offset, $limit); + $response->dynamic(new Document([ + 'templates' => $templates, + 'total' => $total, + ]), Response::MODEL_TEMPLATE_FUNCTION_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php new file mode 100644 index 0000000000..e0d659c9ba --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Usage/Get.php @@ -0,0 +1,159 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Usage; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\WhiteList; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getUsage'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/:functionId/usage') + ->desc('Get function usage') + ->groups(['api', 'functions', 'usage']) + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: null, + name: 'getUsage', + description: <<<EOT + Get usage metrics and statistics for a for a specific function. View statistics including total deployments, builds, executions, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_USAGE_FUNCTION, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function ID.') + ->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $functionId, string $range, Response $response, Database $dbForProject) + { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $periods = Config::getParam('usage', []); + $stats = $usage = []; + $days = $periods[$range]; + $metrics = [ + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS_STORAGE), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_STORAGE), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_COMPUTE), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_COMPUTE), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_MB_SECONDS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_MB_SECONDS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_SUCCESS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_FAILED), + ]; + + Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats) { + foreach ($metrics as $metric) { + $result = $dbForProject->findOne('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', ['inf']) + ]); + + $stats[$metric]['total'] = $result['value'] ?? 0; + $limit = $days['limit']; + $period = $days['period']; + $results = $dbForProject->find('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', [$period]), + Query::limit($limit), + Query::orderDesc('time'), + ]); + $stats[$metric]['data'] = []; + foreach ($results as $result) { + $stats[$metric]['data'][$result->getAttribute('time')] = [ + 'value' => $result->getAttribute('value'), + ]; + } + } + }); + + $format = match ($days['period']) { + '1h' => 'Y-m-d\TH:00:00.000P', + '1d' => 'Y-m-d\T00:00:00.000P', + }; + + foreach ($metrics as $metric) { + $usage[$metric]['total'] = $stats[$metric]['total']; + $usage[$metric]['data'] = []; + $leap = time() - ($days['limit'] * $days['factor']); + while ($leap < time()) { + $leap += $days['factor']; + $formatDate = date($format, $leap); + $usage[$metric]['data'][] = [ + 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, + 'date' => $formatDate, + ]; + } + } + + $buildsTimeTotal = $usage[$metrics[4]]['total'] ?? 0; + $buildsTotal = $usage[$metrics[2]]['total'] ?? 0; + $response->dynamic(new Document([ + 'range' => $range, + 'deploymentsTotal' => $usage[$metrics[0]]['total'], + 'deploymentsStorageTotal' => $usage[$metrics[1]]['total'], + 'buildsTotal' => $usage[$metrics[2]]['total'], + 'buildsSuccessTotal' => $usage[$metrics[9]]['total'], + 'buildsFailedTotal' => $usage[$metrics[10]]['total'], + 'buildsStorageTotal' => $usage[$metrics[3]]['total'], + 'buildsTimeTotal' => $usage[$metrics[4]]['total'], + 'buildsTimeAverage' => $buildsTotal === 0 ? 0 : (int) ($buildsTimeTotal / $buildsTotal), + 'executionsTotal' => $usage[$metrics[5]]['total'], + 'executionsTimeTotal' => $usage[$metrics[6]]['total'], + 'buildsMbSecondsTotal' => $usage[$metrics[7]]['total'], + 'executionsMbSecondsTotal' => $usage[$metrics[8]]['total'], + 'deployments' => $usage[$metrics[0]]['data'], + 'deploymentsStorage' => $usage[$metrics[1]]['data'], + 'builds' => $usage[$metrics[2]]['data'], + 'buildsStorage' => $usage[$metrics[3]]['data'], + 'buildsTime' => $usage[$metrics[4]]['data'], + 'executions' => $usage[$metrics[5]]['data'], + 'executionsTime' => $usage[$metrics[6]]['data'], + 'buildsMbSeconds' => $usage[$metrics[7]]['data'], + 'executionsMbSeconds' => $usage[$metrics[8]]['data'], + 'buildsSuccess' => $usage[$metrics[9]]['data'], + 'buildsFailed' => $usage[$metrics[10]]['data'], + ]), Response::MODEL_USAGE_FUNCTION); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php new file mode 100644 index 0000000000..e64fe9a600 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Usage/XList.php @@ -0,0 +1,149 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Usage; + +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\WhiteList; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'getFunctionsUsage'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/usage') + ->desc('Get functions usage') + ->groups(['api', 'functions', 'usage']) + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('sdk', new Method( + namespace: 'functions', + group: null, + name: 'listUsage', + description: <<<EOT + Get usage metrics and statistics for all functions in the project. View statistics including total deployments, builds, logs, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_USAGE_FUNCTIONS, + ) + ] + )) + ->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $range, Response $response, Database $dbForProject) + { + $periods = Config::getParam('usage', []); + $stats = $usage = []; + $days = $periods[$range]; + $metrics = [ + METRIC_FUNCTIONS, + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_DEPLOYMENTS), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_DEPLOYMENTS_STORAGE), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_BUILDS), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_BUILDS_STORAGE), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_BUILDS_COMPUTE), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_EXECUTIONS), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_EXECUTIONS_COMPUTE), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_BUILDS_MB_SECONDS), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_EXECUTIONS_MB_SECONDS), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_BUILDS_SUCCESS), + str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_BUILDS_FAILED), + ]; + + Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats) { + foreach ($metrics as $metric) { + $result = $dbForProject->findOne('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', ['inf']) + ]); + + $stats[$metric]['total'] = $result['value'] ?? 0; + $limit = $days['limit']; + $period = $days['period']; + $results = $dbForProject->find('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', [$period]), + Query::limit($limit), + Query::orderDesc('time'), + ]); + $stats[$metric]['data'] = []; + foreach ($results as $result) { + $stats[$metric]['data'][$result->getAttribute('time')] = [ + 'value' => $result->getAttribute('value'), + ]; + } + } + }); + + $format = match ($days['period']) { + '1h' => 'Y-m-d\TH:00:00.000P', + '1d' => 'Y-m-d\T00:00:00.000P', + }; + + foreach ($metrics as $metric) { + $usage[$metric]['total'] = $stats[$metric]['total']; + $usage[$metric]['data'] = []; + $leap = time() - ($days['limit'] * $days['factor']); + while ($leap < time()) { + $leap += $days['factor']; + $formatDate = date($format, $leap); + $usage[$metric]['data'][] = [ + 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, + 'date' => $formatDate, + ]; + } + } + $response->dynamic(new Document([ + 'range' => $range, + 'functionsTotal' => $usage[$metrics[0]]['total'], + 'deploymentsTotal' => $usage[$metrics[1]]['total'], + 'deploymentsStorageTotal' => $usage[$metrics[2]]['total'], + 'buildsTotal' => $usage[$metrics[3]]['total'], + 'buildsStorageTotal' => $usage[$metrics[4]]['total'], + 'buildsTimeTotal' => $usage[$metrics[5]]['total'], + 'executionsTotal' => $usage[$metrics[6]]['total'], + 'executionsTimeTotal' => $usage[$metrics[7]]['total'], + 'buildsMbSecondsTotal' => $usage[$metrics[8]]['total'], + 'executionsMbSecondsTotal' => $usage[$metrics[9]]['total'], + 'buildsSuccessTotal' => $usage[$metrics[10]]['total'], + 'buildsFailedTotal' => $usage[$metrics[11]]['total'], + 'functions' => $usage[$metrics[0]]['data'], + 'deployments' => $usage[$metrics[1]]['data'], + 'deploymentsStorage' => $usage[$metrics[2]]['data'], + 'builds' => $usage[$metrics[3]]['data'], + 'buildsStorage' => $usage[$metrics[4]]['data'], + 'buildsTime' => $usage[$metrics[5]]['data'], + 'executions' => $usage[$metrics[6]]['data'], + 'executionsTime' => $usage[$metrics[7]]['data'], + 'buildsMbSeconds' => $usage[$metrics[8]]['data'], + 'executionsMbSeconds' => $usage[$metrics[9]]['data'], + 'buildsSuccess' => $usage[$metrics[10]]['data'], + 'buildsFailed' => $usage[$metrics[11]]['data'], + ]), Response::MODEL_USAGE_FUNCTIONS); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php new file mode 100644 index 0000000000..9300524c64 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Create.php @@ -0,0 +1,128 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Document; +use Utopia\Database\Exception\Duplicate as DuplicateException; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; + +class Create extends Base +{ + use HTTP; + + public static function getName() + { + return 'createVariable'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/functions/:functionId/variables') + ->desc('Create variable') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('audits.event', 'variable.create') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'variables', + name: 'createVariable', + description: <<<EOT + Create a new function environment variable. These variables can be accessed in the function at runtime as environment variables. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_VARIABLE, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function unique ID.', false) + ->param('key', null, new Text(Database::LENGTH_KEY), 'Variable key. Max length: ' . Database::LENGTH_KEY . ' chars.', false) + ->param('value', null, new Text(8192, 0), 'Variable value. Max length: 8192 chars.', false) + ->param('secret', true, new Boolean(), 'Secret variables can be updated or deleted, but only functions can read them during build and runtime.', true) + ->inject('response') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('project') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $key, + string $value, + bool $secret, + Response $response, + Database $dbForProject, + Database $dbForPlatform, + Document $project + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $variableId = ID::unique(); + + $teamId = $project->getAttribute('teamId', ''); + $variable = new Document([ + '$id' => $variableId, + '$permissions' => [ + Permission::read(Role::team(ID::custom($teamId))), + Permission::update(Role::team(ID::custom($teamId), 'owner')), + Permission::update(Role::team(ID::custom($teamId), 'developer')), + Permission::delete(Role::team(ID::custom($teamId), 'owner')), + Permission::delete(Role::team(ID::custom($teamId), 'developer')), + ], + 'resourceInternalId' => $function->getInternalId(), + 'resourceId' => $function->getId(), + 'resourceType' => 'function', + 'key' => $key, + 'value' => $value, + 'secret' => $secret, + 'search' => implode(' ', [$variableId, $function->getId(), $key, 'function']), + ]); + + try { + $variable = $dbForProject->createDocument('variables', $variable); + } catch (DuplicateException $th) { + throw new Exception(Exception::VARIABLE_ALREADY_EXISTS); + } + + $dbForProject->updateDocument('functions', $function->getId(), $function->setAttribute('live', false)); + + // Inform scheduler to pull the latest changes + $schedule = $dbForPlatform->getDocument('schedules', $function->getAttribute('scheduleId')); + $schedule + ->setAttribute('resourceUpdatedAt', DateTime::now()) + ->setAttribute('schedule', $function->getAttribute('schedule')) + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); + Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($variable, Response::MODEL_VARIABLE); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php new file mode 100644 index 0000000000..3d6bfebcb9 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Delete.php @@ -0,0 +1,99 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Delete extends Base +{ + use HTTP; + + public static function getName() + { + return 'deleteVariable'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/functions/:functionId/variables/:variableId') + ->desc('Delete variable') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('audits.event', 'variable.delete') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'variables', + name: 'deleteVariable', + description: <<<EOT + Delete a variable by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('functionId', '', new UID(), 'Function unique ID.', false) + ->param('variableId', '', new UID(), 'Variable unique ID.', false) + ->inject('response') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $variableId, + Response $response, + Database $dbForProject, + Database $dbForPlatform + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $variable = $dbForProject->getDocument('variables', $variableId); + if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceInternalId') !== $function->getInternalId() || $variable->getAttribute('resourceType') !== 'function') { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + if ($variable === false || $variable->isEmpty()) { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + $dbForProject->deleteDocument('variables', $variable->getId()); + + $dbForProject->updateDocument('functions', $function->getId(), $function->setAttribute('live', false)); + + // Inform scheduler to pull the latest changes + $schedule = $dbForPlatform->getDocument('schedules', $function->getAttribute('scheduleId')); + $schedule + ->setAttribute('resourceUpdatedAt', DateTime::now()) + ->setAttribute('schedule', $function->getAttribute('schedule')) + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); + Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php new file mode 100644 index 0000000000..70cc66219a --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Get.php @@ -0,0 +1,83 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getVariable'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/:functionId/variables/:variableId') + ->desc('Get variable') + ->groups(['api', 'functions']) + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label( + 'sdk', + new Method( + namespace: 'functions', + group: 'variables', + name: 'getVariable', + description: <<<EOT + Get a variable by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_VARIABLE, + ) + ], + ) + ) + ->param('functionId', '', new UID(), 'Function unique ID.', false) + ->param('variableId', '', new UID(), 'Variable unique ID.', false) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $functionId, string $variableId, Response $response, Database $dbForProject) + { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $variable = $dbForProject->getDocument('variables', $variableId); + if ( + $variable === false || + $variable->isEmpty() || + $variable->getAttribute('resourceInternalId') !== $function->getInternalId() || + $variable->getAttribute('resourceType') !== 'function' + ) { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + if ($variable === false || $variable->isEmpty()) { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + $response->dynamic($variable, Response::MODEL_VARIABLE); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php new file mode 100644 index 0000000000..4102022267 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/Update.php @@ -0,0 +1,116 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Exception\Duplicate as DuplicateException; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; + +class Update extends Base +{ + use HTTP; + + public static function getName() + { + return 'updateVariable'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PUT) + ->setHttpPath('/v1/functions/:functionId/variables/:variableId') + ->desc('Update variable') + ->groups(['api', 'functions']) + ->label('scope', 'functions.write') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label('audits.event', 'variable.update') + ->label('audits.resource', 'function/{request.functionId}') + ->label('sdk', new Method( + namespace: 'functions', + group: 'variables', + name: 'updateVariable', + description: <<<EOT + Update variable by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_VARIABLE, + ) + ] + )) + ->param('functionId', '', new UID(), 'Function unique ID.', false) + ->param('variableId', '', new UID(), 'Variable unique ID.', false) + ->param('key', null, new Text(255), 'Variable key. Max length: 255 chars.', false) + ->param('value', null, new Text(8192, 0), 'Variable value. Max length: 8192 chars.', true) + ->param('secret', null, new Boolean(), 'Secret variables can be updated or deleted, but only functions can read them during build and runtime.', true) + ->inject('response') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action( + string $functionId, + string $variableId, + string $key, + ?string $value, + ?bool $secret, + Response $response, + Database $dbForProject, + Database $dbForPlatform + ) { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $variable = $dbForProject->getDocument('variables', $variableId); + if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceInternalId') !== $function->getInternalId() || $variable->getAttribute('resourceType') !== 'function') { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + if ($variable->getAttribute('secret') === true && $secret === false) { + throw new Exception(Exception::VARIABLE_CANNOT_UNSET_SECRET); + } + + $variable + ->setAttribute('key', $key) + ->setAttribute('value', $value ?? $variable->getAttribute('value')) + ->setAttribute('secret', $secret ?? $variable->getAttribute('secret')) + ->setAttribute('search', implode(' ', [$variableId, $function->getId(), $key, 'function'])); + + try { + $dbForProject->updateDocument('variables', $variable->getId(), $variable); + } catch (DuplicateException $th) { + throw new Exception(Exception::VARIABLE_ALREADY_EXISTS); + } + + $dbForProject->updateDocument('functions', $function->getId(), $function->setAttribute('live', false)); + + // Inform scheduler to pull the latest changes + $schedule = $dbForPlatform->getDocument('schedules', $function->getAttribute('scheduleId')); + $schedule + ->setAttribute('resourceUpdatedAt', DateTime::now()) + ->setAttribute('schedule', $function->getAttribute('schedule')) + ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deploymentId'))); + Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); + + $response->dynamic($variable, Response::MODEL_VARIABLE); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php b/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php new file mode 100644 index 0000000000..9c02cfe07c --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Http/Variables/XList.php @@ -0,0 +1,72 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listVariables'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/functions/:functionId/variables') + ->desc('List variables') + ->groups(['api', 'functions']) + ->label('scope', 'functions.read') + ->label('resourceType', RESOURCE_TYPE_FUNCTIONS) + ->label( + 'sdk', + new Method( + namespace: 'functions', + group: 'variables', + name: 'listVariables', + description: <<<EOT + Get a list of all variables of a specific function. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_VARIABLE_LIST, + ) + ], + ) + ) + ->param('functionId', '', new UID(), 'Function unique ID.', false) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $functionId, Response $response, Database $dbForProject) + { + $function = $dbForProject->getDocument('functions', $functionId); + + if ($function->isEmpty()) { + throw new Exception(Exception::FUNCTION_NOT_FOUND); + } + + $response->dynamic(new Document([ + 'variables' => $function->getAttribute('vars', []), + 'total' => \count($function->getAttribute('vars', [])), + ]), Response::MODEL_VARIABLE_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Module.php b/src/Appwrite/Platform/Modules/Functions/Module.php new file mode 100644 index 0000000000..18617bb0c8 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Module.php @@ -0,0 +1,16 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions; + +use Appwrite\Platform\Modules\Functions\Services\Http; +use Appwrite\Platform\Modules\Functions\Services\Workers; +use Utopia\Platform; + +class Module extends Platform\Module +{ + public function __construct() + { + $this->addService('http', new Http()); + $this->addService('workers', new Workers()); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Services/Http.php b/src/Appwrite/Platform/Modules/Functions/Services/Http.php new file mode 100644 index 0000000000..cf47574472 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Services/Http.php @@ -0,0 +1,89 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Services; + +use Appwrite\Platform\Modules\Functions\Http\Deployments\Create as CreateDeployment; +use Appwrite\Platform\Modules\Functions\Http\Deployments\Delete as DeleteDeployment; +use Appwrite\Platform\Modules\Functions\Http\Deployments\Download\Get as DownloadDeployment; +use Appwrite\Platform\Modules\Functions\Http\Deployments\Duplicate\Create as CreateDuplicateDeployment; +use Appwrite\Platform\Modules\Functions\Http\Deployments\Get as GetDeployment; +use Appwrite\Platform\Modules\Functions\Http\Deployments\Status\Update as UpdateDeploymentStatus; +use Appwrite\Platform\Modules\Functions\Http\Deployments\Template\Create as CreateTemplateDeployment; +use Appwrite\Platform\Modules\Functions\Http\Deployments\Vcs\Create as CreateVcsDeployment; +use Appwrite\Platform\Modules\Functions\Http\Deployments\XList as ListDeployments; +use Appwrite\Platform\Modules\Functions\Http\Executions\Create as CreateExecution; +use Appwrite\Platform\Modules\Functions\Http\Executions\Delete as DeleteExecution; +use Appwrite\Platform\Modules\Functions\Http\Executions\Get as GetExecution; +use Appwrite\Platform\Modules\Functions\Http\Executions\XList as ListExecutions; +use Appwrite\Platform\Modules\Functions\Http\Functions\Create as CreateFunction; +use Appwrite\Platform\Modules\Functions\Http\Functions\Delete as DeleteFunction; +use Appwrite\Platform\Modules\Functions\Http\Functions\Deployment\Update as UpdateFunctionDeployment; +use Appwrite\Platform\Modules\Functions\Http\Functions\Get as GetFunction; +use Appwrite\Platform\Modules\Functions\Http\Functions\Update as UpdateFunction; +use Appwrite\Platform\Modules\Functions\Http\Functions\XList as ListFunctions; +use Appwrite\Platform\Modules\Functions\Http\Runtimes\XList as ListRuntimes; +use Appwrite\Platform\Modules\Functions\Http\Specifications\XList as ListSpecifications; +use Appwrite\Platform\Modules\Functions\Http\Templates\Get as GetTemplate; +use Appwrite\Platform\Modules\Functions\Http\Templates\XList as ListTemplates; +use Appwrite\Platform\Modules\Functions\Http\Usage\Get as GetUsage; +use Appwrite\Platform\Modules\Functions\Http\Usage\XList as ListUsage; +use Appwrite\Platform\Modules\Functions\Http\Variables\Create as CreateVariable; +use Appwrite\Platform\Modules\Functions\Http\Variables\Delete as DeleteVariable; +use Appwrite\Platform\Modules\Functions\Http\Variables\Get as GetVariable; +use Appwrite\Platform\Modules\Functions\Http\Variables\Update as UpdateVariable; +use Appwrite\Platform\Modules\Functions\Http\Variables\XList as ListVariables; +use Utopia\Platform\Service; + +class Http extends Service +{ + public function __construct() + { + $this->type = Service::TYPE_HTTP; + + // Functions + $this->addAction(CreateFunction::getName(), new CreateFunction()); + $this->addAction(GetFunction::getName(), new GetFunction()); + $this->addAction(UpdateFunction::getName(), new UpdateFunction()); + $this->addAction(ListFunctions::getName(), new ListFunctions()); + $this->addAction(DeleteFunction::getName(), new DeleteFunction()); + + // Runtimes + $this->addAction(ListRuntimes::getName(), new ListRuntimes()); + + // Specifications + $this->addAction(ListSpecifications::getName(), new ListSpecifications()); + + // Deployments + $this->addAction(CreateDeployment::getName(), new CreateDeployment()); + $this->addAction(GetDeployment::getName(), new GetDeployment()); + $this->addAction(UpdateFunctionDeployment::getName(), new UpdateFunctionDeployment()); + $this->addAction(ListDeployments::getName(), new ListDeployments()); + $this->addAction(DeleteDeployment::getName(), new DeleteDeployment()); + $this->addAction(CreateTemplateDeployment::getName(), new CreateTemplateDeployment()); + $this->addAction(CreateVcsDeployment::getName(), new CreateVcsDeployment()); + $this->addAction(DownloadDeployment::getName(), new DownloadDeployment()); + $this->addAction(CreateDuplicateDeployment::getName(), new CreateDuplicateDeployment()); + $this->addAction(UpdateDeploymentStatus::getName(), new UpdateDeploymentStatus()); + + // Executions + $this->addAction(CreateExecution::getName(), new CreateExecution()); + $this->addAction(GetExecution::getName(), new GetExecution()); + $this->addAction(ListExecutions::getName(), new ListExecutions()); + $this->addAction(DeleteExecution::getName(), new DeleteExecution()); + + // Usage + $this->addAction(GetUsage::getName(), new GetUsage()); + $this->addAction(ListUsage::getName(), new ListUsage()); + + // Variables + $this->addAction(CreateVariable::getName(), new CreateVariable()); + $this->addAction(GetVariable::getName(), new GetVariable()); + $this->addAction(ListVariables::getName(), new ListVariables()); + $this->addAction(UpdateVariable::getName(), new UpdateVariable()); + $this->addAction(DeleteVariable::getName(), new DeleteVariable()); + + // Templates + $this->addAction(GetTemplate::getName(), new GetTemplate()); + $this->addAction(ListTemplates::getName(), new ListTemplates()); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Services/Workers.php b/src/Appwrite/Platform/Modules/Functions/Services/Workers.php new file mode 100644 index 0000000000..61256b6bf9 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Services/Workers.php @@ -0,0 +1,15 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Services; + +use Appwrite\Platform\Modules\Functions\Workers\Builds; +use Utopia\Platform\Service; + +class Workers extends Service +{ + public function __construct() + { + $this->type = Service::TYPE_WORKER; + $this->addAction(Builds::getName(), new Builds()); + } +} diff --git a/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php new file mode 100644 index 0000000000..27c6e59128 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Functions/Workers/Builds.php @@ -0,0 +1,1503 @@ +<?php + +namespace Appwrite\Platform\Modules\Functions\Workers; + +use Ahc\Jwt\JWT; +use Appwrite\Event\Event; +use Appwrite\Event\Func; +use Appwrite\Event\Realtime; +use Appwrite\Event\StatsUsage; +use Appwrite\Event\Webhook; +use Appwrite\Permission; +use Appwrite\Role; +use Appwrite\Utopia\Response\Model\Deployment; +use Appwrite\Vcs\Comment; +use Exception; +use Executor\Executor; +use Swoole\Coroutine as Co; +use Utopia\Cache\Cache; +use Utopia\CLI\Console; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Document; +use Utopia\Database\Exception\Conflict; +use Utopia\Database\Exception\Duplicate; +use Utopia\Database\Exception\Restricted; +use Utopia\Database\Exception\Structure; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Detector\Detection\Rendering\SSR; +use Utopia\Detector\Detection\Rendering\XStatic; +use Utopia\Detector\Detector\Rendering; +use Utopia\Fetch\Client as FetchClient; +use Utopia\Logger\Log; +use Utopia\Platform\Action; +use Utopia\Queue\Message; +use Utopia\Storage\Compression\Compression; +use Utopia\Storage\Device; +use Utopia\Storage\Device\Local; +use Utopia\System\System; +use Utopia\VCS\Adapter\Git\GitHub; + +use function Swoole\Coroutine\batch; + +class Builds extends Action +{ + public static function getName(): string + { + return 'builds'; + } + + /** + * @throws Exception + */ + public function __construct() + { + $this + ->desc('Builds worker') + ->inject('message') + ->inject('project') + ->inject('dbForPlatform') + ->inject('queueForEvents') + ->inject('queueForWebhooks') + ->inject('queueForFunctions') + ->inject('queueForRealtime') + ->inject('queueForStatsUsage') + ->inject('cache') + ->inject('dbForProject') + ->inject('deviceForFunctions') + ->inject('deviceForSites') + ->inject('isResourceBlocked') + ->inject('deviceForFiles') + ->inject('log') + ->inject('executor') + ->callback([$this, 'action']); + } + + /** + * @param Message $message + * @param Document $project + * @param Database $dbForPlatform + * @param Event $queueForEvents + * @param Webhook $queueForWebhooks + * @param Func $queueForFunctions + * @param Realtime $queueForRealtime + * @param StatsUsage $queueForStatsUsage + * @param Cache $cache + * @param Database $dbForProject + * @param Device $deviceForFunctions + * @param Device $deviceForSites + * @param Device $deviceForFiles + * @param Log $log + * @param Executor $executor + * @return void + * @throws \Utopia\Database\Exception + */ + public function action( + Message $message, + Document $project, + Database $dbForPlatform, + Event $queueForEvents, + Webhook $queueForWebhooks, + Func $queueForFunctions, + Realtime $queueForRealtime, + StatsUsage $queueForStatsUsage, + Cache $cache, + Database $dbForProject, + Device $deviceForFunctions, + Device $deviceForSites, + callable $isResourceBlocked, + Device $deviceForFiles, + Log $log, + Executor $executor + ): void { + $payload = $message->getPayload() ?? []; + + if (empty($payload)) { + throw new \Exception('Missing payload'); + } + + $type = $payload['type'] ?? ''; + $resource = new Document($payload['resource'] ?? []); + $deployment = new Document($payload['deployment'] ?? []); + $template = new Document($payload['template'] ?? []); + + $log->addTag('projectId', $project->getId()); + $log->addTag('type', $type); + + switch ($type) { + case BUILD_TYPE_DEPLOYMENT: + case BUILD_TYPE_RETRY: + Console::info('Creating build for deployment: ' . $deployment->getId()); + $github = new GitHub($cache); + $this->buildDeployment( + $deviceForFunctions, + $deviceForSites, + $deviceForFiles, + $queueForWebhooks, + $queueForFunctions, + $queueForRealtime, + $queueForEvents, + $queueForStatsUsage, + $dbForPlatform, + $dbForProject, + $github, + $project, + $resource, + $deployment, + $template, + $isResourceBlocked, + $log, + $executor + ); + break; + + default: + throw new \Exception('Invalid build type'); + } + } + + /** + * @param Device $deviceForFunctions + * @param Device $deviceForSites + * @param Device $deviceForFiles + * @param Webhook $queueForWebhooks + * @param Func $queueForFunctions + * @param Realtime $queueForRealtime + * @param Event $queueForEvents + * @param StatsUsage $queueForStatsUsage + * @param Database $dbForPlatform + * @param Database $dbForProject + * @param GitHub $github + * @param Document $project + * @param Document $resource + * @param Document $deployment + * @param Document $template + * @param Log $log + * @param Executor $executor + * @return void + * @throws \Utopia\Database\Exception + * + * @throws Exception + */ + protected function buildDeployment( + Device $deviceForFunctions, + Device $deviceForSites, + Device $deviceForFiles, + Webhook $queueForWebhooks, + Func $queueForFunctions, + Realtime $queueForRealtime, + Event $queueForEvents, + StatsUsage $queueForStatsUsage, + Database $dbForPlatform, + Database $dbForProject, + GitHub $github, + Document $project, + Document $resource, + Document $deployment, + Document $template, + callable $isResourceBlocked, + Log $log, + Executor $executor + ): void { + $resourceKey = match ($resource->getCollection()) { + 'functions' => 'functionId', + 'sites' => 'siteId', + default => throw new \Exception('Invalid resource type') + }; + + $device = match ($resource->getCollection()) { + 'sites' => $deviceForSites, + 'functions' => $deviceForFunctions, + }; + + $log->addTag($resourceKey, $resource->getId()); + + $resource = $dbForProject->getDocument($resource->getCollection(), $resource->getId()); + if ($resource->isEmpty()) { + throw new \Exception('Resource not found'); + } + + if ($isResourceBlocked($project, $resourceKey === 'functions' ? RESOURCE_TYPE_FUNCTIONS : RESOURCE_TYPE_SITES, $resource->getId())) { + throw new \Exception('Resource is blocked'); + } + + $log->addTag('deploymentId', $deployment->getId()); + + $deployment = $dbForProject->getDocument('deployments', $deployment->getId()); + if ($deployment->isEmpty()) { + throw new \Exception('Deployment not found'); + } + + if ($resource->getCollection() === 'functions' && empty($deployment->getAttribute('entrypoint', ''))) { + throw new \Exception('Entrypoint for your Appwrite Function is missing. Please specify it when making deployment or update the entrypoint under your function\'s "Settings" > "Configuration" > "Entrypoint".'); + } + + $version = $this->getVersion($resource); + $runtime = $this->getRuntime($resource, $version); + + $spec = Config::getParam('specifications')[$resource->getAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT)]; + + if ($resource->getCollection() === 'functions' && \is_null($runtime)) { + throw new \Exception('Runtime "' . $resource->getAttribute('runtime', '') . '" is not supported'); + } + + // Realtime preparation + $event = "{$resource->getCollection()}.[{$resourceKey}].deployments.[deploymentId].update"; + $queueForRealtime + ->setSubscribers(['console']) + ->setProject($project) + ->setEvent($event) + ->setParam($resourceKey, $resource->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $startTime = DateTime::now(); + $durationStart = \microtime(true); + + if ($deployment->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); + return; + } + + $deploymentId = $deployment->getId(); + + $deployment->setAttribute('buildStartedAt', $startTime); + $deployment->setAttribute('status', 'processing'); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + + if ($deployment->getInternalId() === $resource->getAttribute('latestDeploymentInternalId', '')) { + $resource = $resource->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), $resource); + } + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + $source = $deployment->getAttribute('sourcePath', ''); + $installationId = $deployment->getAttribute('installationId', ''); + $providerRepositoryId = $deployment->getAttribute('providerRepositoryId', ''); + $providerCommitHash = $deployment->getAttribute('providerCommitHash', ''); + $isVcsEnabled = !empty($providerRepositoryId); + $owner = ''; + $repositoryName = ''; + + if ($isVcsEnabled) { + $installation = $dbForPlatform->getDocument('installations', $installationId); + $providerInstallationId = $installation->getAttribute('providerInstallationId'); + $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); + $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID'); + + $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); + } + + try { + if (!$isVcsEnabled) { + // Non-VCS + Template + $templateRepositoryName = $template->getAttribute('repositoryName', ''); + $templateOwnerName = $template->getAttribute('ownerName', ''); + $templateVersion = $template->getAttribute('version', ''); + + $templateRootDirectory = $template->getAttribute('rootDirectory', ''); + $templateRootDirectory = \rtrim($templateRootDirectory, '/'); + $templateRootDirectory = \ltrim($templateRootDirectory, '.'); + $templateRootDirectory = \ltrim($templateRootDirectory, '/'); + + if (!empty($templateRepositoryName) && !empty($templateOwnerName) && !empty($templateVersion)) { + $stdout = ''; + $stderr = ''; + + // Clone template repo + $tmpTemplateDirectory = '/tmp/builds/' . $deploymentId . '-template'; + $gitCloneCommandForTemplate = $github->generateCloneCommand($templateOwnerName, $templateRepositoryName, $templateVersion, GitHub::CLONE_TYPE_TAG, $tmpTemplateDirectory, $templateRootDirectory); + $exit = Console::execute($gitCloneCommandForTemplate, '', $stdout, $stderr); + + if ($exit !== 0) { + throw new \Exception('Unable to clone code repository: ' . $stderr); + } + + Console::execute('find ' . \escapeshellarg($tmpTemplateDirectory) . ' -type d -name ".git" -exec rm -rf {} +', '', $stdout, $stderr); + + // Ensure directories + Console::execute('mkdir -p ' . \escapeshellarg($tmpTemplateDirectory . '/' . $templateRootDirectory), '', $stdout, $stderr); + + $tmpPathFile = $tmpTemplateDirectory . '/code.tar.gz'; + + $localDevice = new Local(); + + if (substr($tmpTemplateDirectory, -1) !== '/') { + $tmpTemplateDirectory .= '/'; + } + + $tarParamDirectory = \escapeshellarg($tmpTemplateDirectory . (empty($templateRootDirectory) ? '' : '/' . $templateRootDirectory)); + Console::execute('tar --exclude code.tar.gz -czf ' . \escapeshellarg($tmpPathFile) . ' -C ' . \escapeshellcmd($tarParamDirectory) . ' .', '', $stdout, $stderr); // TODO: Replace escapeshellcmd with escapeshellarg if we find a way that doesnt break syntax + + $source = $device->getPath($deployment->getId() . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION)); + $result = $localDevice->transfer($tmpPathFile, $source, $device); + + if (!$result) { + throw new \Exception("Unable to move file"); + } + + Console::execute('rm -rf ' . \escapeshellarg($tmpTemplateDirectory), '', $stdout, $stderr); + + $directorySize = $device->getFileSize($source); + $deployment + ->setAttribute('sourcePath', $source) + ->setAttribute('sourceSize', $directorySize) + ->setAttribute('totalSize', $directorySize); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + } + } elseif ($isVcsEnabled) { + // VCS and VCS+Temaplte + $tmpDirectory = '/tmp/builds/' . $deploymentId . '/code'; + $rootDirectory = $resource->getAttribute('providerRootDirectory', ''); + $rootDirectory = \rtrim($rootDirectory, '/'); + $rootDirectory = \ltrim($rootDirectory, '.'); + $rootDirectory = \ltrim($rootDirectory, '/'); + + $owner = $github->getOwnerName($providerInstallationId); + $repositoryName = $github->getRepositoryName($providerRepositoryId); + + $cloneOwner = $deployment->getAttribute('providerRepositoryOwner', $owner); + $cloneRepository = $deployment->getAttribute('providerRepositoryName', $repositoryName); + + $branchName = $deployment->getAttribute('providerBranch'); + $commitHash = $deployment->getAttribute('providerCommitHash', ''); + + $cloneVersion = $branchName; + $cloneType = GitHub::CLONE_TYPE_BRANCH; + if (!empty($commitHash)) { + $cloneVersion = $commitHash; + $cloneType = GitHub::CLONE_TYPE_COMMIT; + } + + $gitCloneCommand = $github->generateCloneCommand($cloneOwner, $cloneRepository, $cloneVersion, $cloneType, $tmpDirectory, $rootDirectory); + $stdout = ''; + $stderr = ''; + + Console::execute('mkdir -p ' . \escapeshellarg('/tmp/builds/' . $deploymentId), '', $stdout, $stderr); + + if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); + return; + } + + $exit = Console::execute($gitCloneCommand, '', $stdout, $stderr); + + if ($exit !== 0) { + throw new \Exception('Unable to clone code repository: ' . $stderr); + } + + // Local refactoring for function folder with spaces + if (str_contains($rootDirectory, ' ')) { + $rootDirectoryWithoutSpaces = str_replace(' ', '', $rootDirectory); + $from = $tmpDirectory . '/' . $rootDirectory; + $to = $tmpDirectory . '/' . $rootDirectoryWithoutSpaces; + $exit = Console::execute('mv "' . \escapeshellarg($from) . '" "' . \escapeshellarg($to) . '"', '', $stdout, $stderr); + + if ($exit !== 0) { + throw new \Exception('Unable to move function with spaces' . $stderr); + } + $rootDirectory = $rootDirectoryWithoutSpaces; + } + + + // Build from template + $templateRepositoryName = $template->getAttribute('repositoryName', ''); + $templateOwnerName = $template->getAttribute('ownerName', ''); + $templateVersion = $template->getAttribute('version', ''); + + $templateRootDirectory = $template->getAttribute('rootDirectory', ''); + $templateRootDirectory = \rtrim($templateRootDirectory, '/'); + $templateRootDirectory = \ltrim($templateRootDirectory, '.'); + $templateRootDirectory = \ltrim($templateRootDirectory, '/'); + + if (!empty($templateRepositoryName) && !empty($templateOwnerName) && !empty($templateVersion)) { + // Clone template repo + $tmpTemplateDirectory = '/tmp/builds/' . $deploymentId . '/template'; + + $gitCloneCommandForTemplate = $github->generateCloneCommand($templateOwnerName, $templateRepositoryName, $templateVersion, GitHub::CLONE_TYPE_TAG, $tmpTemplateDirectory, $templateRootDirectory); + $exit = Console::execute($gitCloneCommandForTemplate, '', $stdout, $stderr); + + if ($exit !== 0) { + throw new \Exception('Unable to clone code repository: ' . $stderr); + } + + // Ensure directories + Console::execute('mkdir -p ' . \escapeshellarg($tmpTemplateDirectory . '/' . $templateRootDirectory), '', $stdout, $stderr); + Console::execute('mkdir -p ' . \escapeshellarg($tmpDirectory . '/' . $rootDirectory), '', $stdout, $stderr); + + // Merge template into user repo + Console::execute('rsync -av --exclude \'.git\' ' . \escapeshellarg($tmpTemplateDirectory . '/' . $templateRootDirectory . '/') . ' ' . \escapeshellarg($tmpDirectory . '/' . $rootDirectory), '', $stdout, $stderr); + + // Commit and push + $exit = Console::execute('git config --global user.email "team@appwrite.io" && git config --global user.name "Appwrite" && cd ' . \escapeshellarg($tmpDirectory) . ' && git add . && git commit -m "Create ' . \escapeshellarg($resource->getAttribute('name', '')) . ' function" && git push origin ' . \escapeshellarg($branchName), '', $stdout, $stderr); + + if ($exit !== 0) { + throw new \Exception('Unable to push code repository: ' . $stderr); + } + + $exit = Console::execute('cd ' . \escapeshellarg($tmpDirectory) . ' && git rev-parse HEAD', '', $stdout, $stderr); + + if ($exit !== 0) { + throw new \Exception('Unable to get vcs commit SHA: ' . $stderr); + } + + $providerCommitHash = \trim($stdout); + $authorUrl = "https://github.com/$cloneOwner"; + + $deployment->setAttribute('providerCommitHash', $providerCommitHash ?? ''); + $deployment->setAttribute('providerCommitAuthorUrl', $authorUrl); + $deployment->setAttribute('providerCommitAuthor', 'Appwrite'); + $deployment->setAttribute('providerCommitMessage', "Create '" . $resource->getAttribute('name', '') . "' function"); + $deployment->setAttribute('providerCommitUrl', "https://github.com/$cloneOwner/$cloneRepository/commit/$providerCommitHash"); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + } + + $tmpPath = '/tmp/builds/' . $deploymentId; + $tmpPathFile = $tmpPath . '/code.tar.gz'; + $localDevice = new Local(); + + if (substr($tmpDirectory, -1) !== '/') { + $tmpDirectory .= '/'; + } + + $directorySize = $localDevice->getDirectorySize($tmpDirectory); + $sizeLimit = (int)System::getEnv('_APP_COMPUTE_SIZE_LIMIT', '30000000'); + + if ($directorySize > $sizeLimit) { + throw new \Exception('Repository directory size should be less than ' . number_format($sizeLimit / 1048576, 2) . ' MBs.'); + } + + Console::execute('find ' . \escapeshellarg($tmpDirectory) . ' -type d -name ".git" -exec rm -rf {} +', '', $stdout, $stderr); + + $tarParamDirectory = '/tmp/builds/' . $deploymentId . '/code' . (empty($rootDirectory) ? '' : '/' . $rootDirectory); + Console::execute('tar --exclude code.tar.gz -czf ' . \escapeshellarg($tmpPathFile) . ' -C ' . \escapeshellcmd($tarParamDirectory) . ' .', '', $stdout, $stderr); // TODO: Replace escapeshellcmd with escapeshellarg if we find a way that doesnt break syntax + + $source = $device->getPath($deployment->getId() . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION)); + $result = $localDevice->transfer($tmpPathFile, $source, $device); + + if (!$result) { + throw new \Exception("Unable to move file"); + } + + Console::execute('rm -rf ' . \escapeshellarg($tmpPath), '', $stdout, $stderr); + + $directorySize = $device->getFileSize($source); + + $deployment + ->setAttribute('sourcePath', $source) + ->setAttribute('sourceSize', $directorySize) + ->setAttribute('totalSize', $directorySize); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + $this->runGitAction('processing', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform); + } + + /** Request the executor to build the code... */ + $deployment->setAttribute('status', 'building'); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + + if ($deployment->getInternalId() === $resource->getAttribute('latestDeploymentInternalId', '')) { + $resource = $resource->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), $resource); + } + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + if ($isVcsEnabled) { + $this->runGitAction('building', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform); + } + + $deploymentModel = new Deployment(); + $deploymentUpdate = + $queueForEvents + ->setProject($project) + ->setEvent("{$resource->getCollection()}.[{$resourceKey}].deployments.[deploymentId].update") + ->setParam($resourceKey, $resource->getId()) + ->setParam('deploymentId', $deployment->getId()) + ->setPayload($deployment->getArrayCopy(array_keys($deploymentModel->getRules()))); + + /** Trigger Webhook */ + $queueForWebhooks + ->from($deploymentUpdate) + ->trigger(); + + /** Trigger Functions */ + $queueForFunctions + ->from($deploymentUpdate) + ->trigger(); + + /** Trigger Realtime Event */ + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + $vars = []; + + // Shared vars + foreach ($resource->getAttribute('varsProject', []) as $var) { + $vars[$var->getAttribute('key')] = $var->getAttribute('value', ''); + } + + // Function vars + foreach ($resource->getAttribute('vars', []) as $var) { + $vars[$var->getAttribute('key')] = $var->getAttribute('value', ''); + } + + // Some runtimes/frameworks can't compile with less memory than this + $minMemory = $resource->getCollection() === 'sites' ? 2048 : 1024; + + if ($resource->getAttribute('framework', '') === 'analog') { + $minMemory = 4096; + } + + $cpus = $spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT; + $memory = max($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT, $minMemory); + $timeout = (int) System::getEnv('_APP_COMPUTE_BUILD_TIMEOUT', 900); + + + $jwtExpiry = (int)System::getEnv('_APP_COMPUTE_BUILD_TIMEOUT', 900); + $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', $jwtExpiry, 0); + + $apiKey = $jwtObj->encode([ + 'projectId' => $project->getId(), + 'scopes' => $resource->getAttribute('scopes', []) + ]); + + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $hostname = System::getEnv('_APP_DOMAIN'); + $endpoint = $protocol . '://' . $hostname . "/v1"; + + // Appwrite vars + $vars = \array_merge($vars, [ + 'APPWRITE_VERSION' => APP_VERSION_STABLE, + 'APPWRITE_REGION' => $project->getAttribute('region'), + 'APPWRITE_DEPLOYMENT_TYPE' => $deployment->getAttribute('type', ''), + 'APPWRITE_VCS_REPOSITORY_ID' => $deployment->getAttribute('providerRepositoryId', ''), + 'APPWRITE_VCS_REPOSITORY_NAME' => $deployment->getAttribute('providerRepositoryName', ''), + 'APPWRITE_VCS_REPOSITORY_OWNER' => $deployment->getAttribute('providerRepositoryOwner', ''), + 'APPWRITE_VCS_REPOSITORY_URL' => $deployment->getAttribute('providerRepositoryUrl', ''), + 'APPWRITE_VCS_REPOSITORY_BRANCH' => $deployment->getAttribute('providerBranch', ''), + 'APPWRITE_VCS_REPOSITORY_BRANCH_URL' => $deployment->getAttribute('providerBranchUrl', ''), + 'APPWRITE_VCS_COMMIT_HASH' => $deployment->getAttribute('providerCommitHash', ''), + 'APPWRITE_VCS_COMMIT_MESSAGE' => $deployment->getAttribute('providerCommitMessage', ''), + 'APPWRITE_VCS_COMMIT_URL' => $deployment->getAttribute('providerCommitUrl', ''), + 'APPWRITE_VCS_COMMIT_AUTHOR_NAME' => $deployment->getAttribute('providerCommitAuthor', ''), + 'APPWRITE_VCS_COMMIT_AUTHOR_URL' => $deployment->getAttribute('providerCommitAuthorUrl', ''), + 'APPWRITE_VCS_ROOT_DIRECTORY' => $deployment->getAttribute('providerRootDirectory', ''), + ]); + + switch ($resource->getCollection()) { + case 'functions': + $vars = [ + ...$vars, + 'APPWRITE_FUNCTION_API_ENDPOINT' => $endpoint, + 'APPWRITE_FUNCTION_API_KEY' => API_KEY_DYNAMIC . '_' . $apiKey, + 'APPWRITE_FUNCTION_ID' => $resource->getId(), + 'APPWRITE_FUNCTION_NAME' => $resource->getAttribute('name'), + 'APPWRITE_FUNCTION_DEPLOYMENT' => $deployment->getId(), + 'APPWRITE_FUNCTION_PROJECT_ID' => $project->getId(), + 'APPWRITE_FUNCTION_RUNTIME_NAME' => $runtime['name'] ?? '', + 'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'] ?? '', + 'APPWRITE_FUNCTION_CPUS' => $cpus, + 'APPWRITE_FUNCTION_MEMORY' => $memory, + ]; + break; + case 'sites': + $vars = [ + ...$vars, + 'APPWRITE_SITE_API_ENDPOINT' => $endpoint, + 'APPWRITE_SITE_API_KEY' => API_KEY_DYNAMIC . '_' . $apiKey, + 'APPWRITE_SITE_ID' => $resource->getId(), + 'APPWRITE_SITE_NAME' => $resource->getAttribute('name'), + 'APPWRITE_SITE_DEPLOYMENT' => $deployment->getId(), + 'APPWRITE_SITE_PROJECT_ID' => $project->getId(), + 'APPWRITE_SITE_RUNTIME_NAME' => $runtime['name'] ?? '', + 'APPWRITE_SITE_RUNTIME_VERSION' => $runtime['version'] ?? '', + 'APPWRITE_SITE_CPUS' => $cpus, + 'APPWRITE_SITE_MEMORY' => $memory, + ]; + break; + } + + $command = $this->getCommand( + resource: $resource, + deployment: $deployment + ); + + $response = null; + $err = null; + + if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); + return; + } + + $isCanceled = false; + + Co::join([ + Co\go(function () use ($executor, &$response, $project, $deployment, $source, $resource, $runtime, $vars, $command, $cpus, $memory, $timeout, &$err, $version) { + try { + if ($version === 'v2') { + $command = 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh'; + } else { + if ($resource->getCollection() === 'sites') { + $listFilesCommand = ''; + + // Start separation, enter build folder + $listFilesCommand .= 'echo "{APPWRITE_DETECTION_SEPARATOR_START}" && cd /usr/local/build'; + + // Enter output directory, if set + if (!empty($resource->getAttribute('outputDirectory', ''))) { + $listFilesCommand .= ' && cd ' . \escapeshellarg($resource->getAttribute('outputDirectory', '')); + } + + // Print files, and end separation + $listFilesCommand .= ' && find . -name \'node_modules\' -prune -o -type f -print && echo "{APPWRITE_DETECTION_SEPARATOR_END}"'; + + // Use SSR file listing + if (empty($command)) { + $command = $listFilesCommand; + } else { + $command .= ' && ' . $listFilesCommand; + } + } + + $command = 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh ' . \trim(\escapeshellarg($command)); + } + + $response = $executor->createRuntime( + deploymentId: $deployment->getId(), + projectId: $project->getId(), + source: $source, + image: $runtime['image'], + version: $version, + cpus: $cpus, + memory: $memory, + timeout: $timeout, + remove: true, + entrypoint: $deployment->getAttribute('entrypoint', ''), + destination: APP_STORAGE_BUILDS . "/app-{$project->getId()}", + variables: $vars, + command: $command, + outputDirectory: $resource->getAttribute('outputDirectory', '') + ); + } catch (\Throwable $error) { + $err = $error; + } + }), + Co\go(function () use ($executor, $project, &$deployment, &$response, $dbForProject, $timeout, &$err, $queueForRealtime, &$isCanceled) { + try { + $insideSeparation = false; + + $executor->getLogs( + deploymentId: $deployment->getId(), + projectId: $project->getId(), + timeout: $timeout, + callback: function ($logs) use (&$response, &$err, $dbForProject, &$isCanceled, &$deployment, $queueForRealtime, &$insideSeparation) { + if ($isCanceled) { + return; + } + + // If we have response or error from concurrent coroutine, we already have latest logs + if ($response === null && $err === null) { + $deployment = $dbForProject->getDocument('deployments', $deployment->getId()); + + if ($deployment->getAttribute('status') === 'canceled') { + $isCanceled = true; + Console::info('Ignoring realtime logs because build has been canceled'); + return; + } + + // Get only valid UTF8 part - removes leftover half-multibytes causing SQL errors + $logs = \mb_substr($logs, 0, null, 'UTF-8'); + + // Do not stream logs added for SSR detection + if (!$insideSeparation) { + $separator = \strpos($logs, '{APPWRITE_DETECTION_SEPARATOR_START}'); + if ($separator !== false) { + $logs = \substr($logs, 0, $separator); + $insideSeparation = true; + } + } else { + $logs = ''; + $separator = \strpos($logs, '{APPWRITE_DETECTION_SEPARATOR_END}'); + if ($separator !== false) { + $logs = \substr($logs, $separator + strlen('{APPWRITE_DETECTION_SEPARATOR_END}')); + $insideSeparation = false; + } + } + + if (empty($logs)) { + return; + } + + $currentLogs = $deployment->getAttribute('buildLogs', ''); + $affected = false; + + $streamLogs = \str_replace("\\n", "{APPWRITE_LINEBREAK_PLACEHOLDER}", $logs); + foreach (\explode("\n", $streamLogs) as $streamLog) { + if (empty($streamLog)) { + continue; + } + + $streamLog = \str_replace("{APPWRITE_LINEBREAK_PLACEHOLDER}", "\n", $streamLog); + $streamParts = \explode(" ", $streamLog, 2); + + // TODO: use part[0] as timestamp when switching to dbForLogs for build logs + $currentLogs .= $streamParts[1]; + + if (!empty($streamParts[1])) { + $affected = true; + } + } + + if ($affected) { + $deployment = $deployment->setAttribute('buildLogs', $currentLogs); + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + } + } + } + ); + } catch (\Throwable $error) { + if (empty($err)) { + $err = $error; + } + } + }), + ]); + + if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); + return; + } + + if ($err) { + throw $err; + } + + $endTime = DateTime::now(); + $durationEnd = \microtime(true); + + $buildSizeLimit = (int)System::getEnv('_APP_COMPUTE_BUILD_SIZE_LIMIT', '2000000000'); + if ($response['size'] > $buildSizeLimit) { + throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / 1048576, 2) . ' MBs.'); + } + + /** Update the build document */ + $deployment->setAttribute('buildStartedAt', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime'])))); + $deployment->setAttribute('buildEndedAt', $endTime); + $deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart))); + $deployment->setAttribute('buildPath', $response['path']); + $deployment->setAttribute('buildSize', $response['size']); + $deployment->setAttribute('totalSize', $deployment->getAttribute('buildSize', 0) + $deployment->getAttribute('sourceSize', 0)); + + $logs = ''; + foreach ($response['output'] as $log) { + $logs .= $log['content']; + } + + // Separate logs for SSR detection + $detectionLogs = ''; + $separator = \strpos($logs, '{APPWRITE_DETECTION_SEPARATOR_START}'); + if ($separator !== false) { + $detectionLogs = \substr($logs, $separator + strlen('{APPWRITE_DETECTION_SEPARATOR}')); + $separatorEnd = \strpos($detectionLogs, '{APPWRITE_DETECTION_SEPARATOR_END}'); + $logs .= \substr($detectionLogs, $separatorEnd + strlen('{APPWRITE_DETECTION_SEPARATOR_END}')); + $detectionLogs = \substr($detectionLogs, 0, $separatorEnd); + $logs = \substr($logs, 0, $separator); + } + + if ($resource->getCollection() === 'sites') { + $date = \date('H:i:s'); + $logs .= "[$date] [appwrite] Screenshot capturing started. \n"; + } + + $deployment->setAttribute('buildLogs', $logs); + + if ($resource->getCollection() === 'sites' && !empty($detectionLogs)) { + $files = \explode("\n", $detectionLogs); // Parse output + $files = \array_filter($files); // Remove empty + $files = \array_map(fn ($file) => \trim($file), $files); // Remove whitepsaces + $files = \array_map(fn ($file) => \str_starts_with($file, './') ? \substr($file, 2) : $file, $files); // Remove beginning ./ + + $detector = new Rendering($files, $resource->getAttribute('framework', '')); + $detector + ->addOption(new SSR()) + ->addOption(new XStatic()); + $detection = $detector->detect(); + + $adapter = $resource->getAttribute('adapter', ''); + if (empty($adapter)) { + $resource->setAttribute('adapter', $detection->getName()); + $resource->setAttribute('fallbackFile', $detection->getFallbackFile() ?? ''); + $resource = $dbForProject->updateDocument('sites', $resource->getId(), $resource); + + $deployment->setAttribute('adapter', $detection->getName()); + $deployment->setAttribute('fallbackFile', $detection->getFallbackFile() ?? ''); + } elseif ($adapter === 'ssr' && $detection->getName() === 'static') { + throw new \Exception('Adapter mismatch. Detected: ' . $detection->getName() . ' does not match with the set adapter: ' . $adapter); + } + } + + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + /** Screenshot site */ + if ($resource->getCollection() === 'sites') { + try { + $rule = Authorization::skip(fn () => $dbForPlatform->findOne('rules', [ + Query::equal("projectInternalId", [$project->getInternalId()]), + Query::equal("type", ["deployment"]), + Query::equal('deploymentInternalId', [$deployment->getInternalId()]), + ])); + + if ($rule->isEmpty()) { + throw new \Exception("Rule for build not found"); + } + + $client = new FetchClient(); + $client->setTimeout(\intval($resource->getAttribute('timeout', '15'))); + $client->addHeader('content-type', FetchClient::CONTENT_TYPE_APPLICATION_JSON); + + $bucket = Authorization::skip(fn () => $dbForPlatform->getDocument('buckets', 'screenshots')); + + $configs = [ + 'screenshotLight' => [ + 'headers' => [ 'x-appwrite-hostname' => $rule->getAttribute('domain') ], + 'url' => 'http://appwrite/?appwrite-preview=1&appwrite-theme=light', + 'theme' => 'light' + ], + 'screenshotDark' => [ + 'headers' => [ 'x-appwrite-hostname' => $rule->getAttribute('domain') ], + 'url' => 'http://appwrite/?appwrite-preview=1&appwrite-theme=dark', + 'theme' => 'dark' + ], + ]; + + $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 0); + $apiKey = $jwtObj->encode([ + 'hostnameOverride' => true, + 'disabledMetrics' => [ + METRIC_EXECUTIONS, + METRIC_EXECUTIONS_COMPUTE, + METRIC_EXECUTIONS_MB_SECONDS, + METRIC_NETWORK_REQUESTS, + METRIC_NETWORK_INBOUND, + METRIC_NETWORK_OUTBOUND, + str_replace(["{resourceType}"], [RESOURCE_TYPE_SITES], METRIC_RESOURCE_TYPE_EXECUTIONS), + str_replace(["{resourceType}"], [RESOURCE_TYPE_SITES], METRIC_RESOURCE_TYPE_EXECUTIONS_COMPUTE), + str_replace(["{resourceType}"], [RESOURCE_TYPE_SITES], METRIC_RESOURCE_TYPE_EXECUTIONS_MB_SECONDS), + str_replace(["{resourceType}", "{resourceInternalId}"], [RESOURCE_TYPE_SITES, $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS), + str_replace(["{resourceType}", "{resourceInternalId}"], [RESOURCE_TYPE_SITES, $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_COMPUTE), + str_replace(["{resourceType}", "{resourceInternalId}"], [RESOURCE_TYPE_SITES, $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_MB_SECONDS), + ], + 'bannerDisabled' => true, + 'projectCheckDisabled' => true, + 'previewAuthDisabled' => true, + 'deploymentStatusIgnored' => true + ]); + + $screenshotError = null; + $screenshots = batch(\array_map(function ($key) use ($configs, $apiKey, $resource, $client, &$screenshotError) { + return function () use ($key, $configs, $apiKey, $resource, $client, &$screenshotError) { + try { + $config = $configs[$key]; + + $config['headers'] = \array_merge($config['headers'] ?? [], [ + 'x-appwrite-key' => API_KEY_DYNAMIC . '_' . $apiKey + ]); + $config['sleep'] = 3000; + + $frameworks = Config::getParam('frameworks', []); + $framework = $frameworks[$resource->getAttribute('framework', '')] ?? null; + if (!is_null($framework)) { + $config['sleep'] = $framework['screenshotSleep']; + } + + $fetchResponse = $client->fetch( + url: 'http://appwrite-browser:3000/v1/screenshots', + method: 'POST', + body: $config + ); + + if ($fetchResponse->getStatusCode() >= 400) { + throw new \Exception($fetchResponse->getBody()); + } + + $screenshot = $fetchResponse->getBody(); + + return ['key' => $key, 'screenshot' => $screenshot]; + } catch (\Throwable $th) { + $screenshotError = $th->getMessage(); + return; + } + }; + }, \array_keys($configs))); + + if (!\is_null($screenshotError)) { + throw new \Exception($screenshotError); + } + + foreach ($screenshots as $data) { + $key = $data['key']; + $screenshot = $data['screenshot']; + + $fileId = ID::unique(); + $fileName = $fileId . '.png'; + $path = $deviceForFiles->getPath($fileName); + $path = str_ireplace($deviceForFiles->getRoot(), $deviceForFiles->getRoot() . DIRECTORY_SEPARATOR . $bucket->getId(), $path); // Add bucket id to path after root + $success = $deviceForFiles->write($path, $screenshot, "image/png"); + + if (!$success) { + throw new \Exception("Screenshot failed to save"); + } + + $teamId = $project->getAttribute('teamId', ''); + $file = new Document([ + '$id' => $fileId, + '$permissions' => [ + Permission::read(Role::team(ID::custom($teamId))), + ], + 'bucketId' => $bucket->getId(), + 'bucketInternalId' => $bucket->getInternalId(), + 'name' => $fileName, + 'path' => $path, + 'signature' => $deviceForFiles->getFileHash($path), + 'mimeType' => $deviceForFiles->getFileMimeType($path), + 'sizeOriginal' => \strlen($screenshot), + 'sizeActual' => $deviceForFiles->getFileSize($path), + 'algorithm' => Compression::GZIP, + 'comment' => '', + 'chunksTotal' => 1, + 'chunksUploaded' => 1, + 'openSSLVersion' => null, + 'openSSLCipher' => null, + 'openSSLTag' => null, + 'openSSLIV' => null, + 'search' => implode(' ', [$fileId, $fileName]), + 'metadata' => ['content_type' => $deviceForFiles->getFileMimeType($path)], + ]); + + Authorization::skip(fn () => $dbForPlatform->createDocument('bucket_' . $bucket->getInternalId(), $file)); + + $deployment->setAttribute($key, $fileId); + } + + $logs = $deployment->getAttribute('buildLogs', ''); + $date = \date('H:i:s'); + $logs .= "[$date] [appwrite] Screenshot capturing finished. \n"; + + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + } catch (\Throwable $th) { + Console::warning("Screenshot failed to generate:"); + Console::warning($th->getMessage()); + Console::warning($th->getTraceAsString()); + + $logs = $deployment->getAttribute('buildLogs', ''); + $date = \date('H:i:s'); + $logs .= "[$date] [appwrite] Screenshot capturing failed. Deployment will continue. \n"; + + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); + } + } + + $logs = $deployment->getAttribute('buildLogs', ''); + $date = \date('H:i:s'); + $logs .= "[$date] [appwrite] Deployment finished. \n"; + $deployment->setAttribute('buildLogs', $logs); + + /** Update the status */ + $deployment->setAttribute('status', 'ready'); + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment); + + if ($deployment->getInternalId() === $resource->getAttribute('latestDeploymentInternalId', '')) { + $resource = $resource->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), $resource); + } + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + if ($isVcsEnabled) { + $this->runGitAction('ready', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform); + } + + Console::success("Build id: $deploymentId created"); + + /** Set auto deploy */ + if ($deployment->getAttribute('activate') === true) { + $resource->setAttribute('live', true); + switch ($resource->getCollection()) { + case 'functions': + $oldDeploymentInternalId = $resource->getAttribute('deploymentInternalId', ''); + + $resource->setAttribute('deploymentId', $deployment->getId()); + $resource->setAttribute('deploymentInternalId', $deployment->getInternalId()); + $resource->setAttribute('deploymentCreatedAt', $deployment->getCreatedAt()); + $resource = $dbForProject->updateDocument('functions', $resource->getId(), $resource); + + $queries = [ + Query::equal("projectInternalId", [$project->getInternalId()]), + Query::equal("type", ["deployment"]), + Query::equal("deploymentResourceInternalId", [$resource->getInternalId()]), + Query::equal('deploymentResourceType', ['function']), + Query::equal('trigger', ['manual']), + ]; + + if (empty($oldDeploymentInternalId)) { + $queries[] = Query::equal("deploymentInternalId", [""]); + } else { + $queries[] = Query::equal("deploymentInternalId", [$oldDeploymentInternalId]); + } + + $rulesUpdated = false; + $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment, &$rulesUpdated) { + $rulesUpdated = true; + $rule = $rule + ->setAttribute('deploymentId', $deployment->getId()) + ->setAttribute('deploymentInternalId', $deployment->getInternalId()); + $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + }); + break; + case 'sites': + $oldDeploymentInternalId = $resource->getAttribute('deploymentInternalId', ''); + + $resource->setAttribute('deploymentId', $deployment->getId()); + $resource->setAttribute('deploymentInternalId', $deployment->getInternalId()); + $resource->setAttribute('deploymentScreenshotDark', $deployment->getAttribute('screenshotDark', '')); + $resource->setAttribute('deploymentScreenshotLight', $deployment->getAttribute('screenshotLight', '')); + $resource->setAttribute('deploymentCreatedAt', $deployment->getCreatedAt()); + $resource = $dbForProject->updateDocument('sites', $resource->getId(), $resource); + $queries = [ + Query::equal("projectInternalId", [$project->getInternalId()]), + Query::equal("type", ["deployment"]), + Query::equal("deploymentResourceInternalId", [$resource->getInternalId()]), + Query::equal('deploymentResourceType', ['site']), + Query::equal('trigger', ['manual']), + ]; + + if (empty($oldDeploymentInternalId)) { + $queries[] = Query::equal("deploymentInternalId", [""]); + } else { + $queries[] = Query::equal("deploymentInternalId", [$oldDeploymentInternalId]); + } + + $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { + $rule = $rule + ->setAttribute('deploymentId', $deployment->getId()) + ->setAttribute('deploymentInternalId', $deployment->getInternalId()); + $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + }); + + break; + } + } + + if ($resource->getCollection() === 'sites') { + // VCS branch + $branchName = $deployment->getAttribute('providerBranch'); + if (!empty($branchName)) { + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + $domain = "branch-{$branchName}-{$resource->getId()}-{$project->getId()}.{$sitesDomain}"; + $ruleId = md5($domain); + + try { + $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain, + 'type' => 'deployment', + 'trigger' => 'deployment', + 'deploymentId' => $deployment->getId(), + 'deploymentInternalId' => $deployment->getInternalId(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $deployment->getId(), + 'deploymentResourceInternalId' => $deployment->getInternalId(), + 'deploymentVcsProviderBranch' => $branchName, + 'status' => 'verified', + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain]), + 'owner' => 'Appwrite', + 'region' => $project->getAttribute('region') + ])); + } catch (Duplicate $err) { + $rule = $dbForPlatform->getDocument('rules', $ruleId); + $rule = $rule + ->setAttribute('deploymentId', $deployment->getId()) + ->setAttribute('deploymentInternalId', $deployment->getInternalId()); + $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + } + + $this->listRules($project, [ + Query::equal("projectInternalId", [$project->getInternalId()]), + Query::equal("type", ["deployment"]), + Query::equal("deploymentResourceInternalId", [$resource->getInternalId()]), + Query::equal('deploymentResourceType', ['site']), + Query::equal("deploymentVcsProviderBranch", [$branchName]), + Query::equal("trigger", ['manual']), + ], $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { + $rule = $rule + ->setAttribute('deploymentId', $deployment->getId()) + ->setAttribute('deploymentInternalId', $deployment->getInternalId()); + $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + }); + } + } + + if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); + return; + } + + /** Update function schedule */ + + // Inform scheduler if function is still active + if ($resource->getCollection() === 'functions') { + $schedule = $dbForPlatform->getDocument('schedules', $resource->getAttribute('scheduleId')); + $schedule + ->setAttribute('resourceUpdatedAt', DateTime::now()) + ->setAttribute('schedule', $resource->getAttribute('schedule')) + ->setAttribute('active', !empty($resource->getAttribute('schedule')) && !empty($resource->getAttribute('deploymentId'))); + Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); + } + } catch (\Throwable $th) { + Console::warning('Build failed:'); + Console::error($th->getMessage()); + Console::error($th->getFile()); + Console::error($th->getLine()); + Console::error($th->getTraceAsString()); + + if ($dbForProject->getDocument('deployments', $deploymentId)->getAttribute('status') === 'canceled') { + Console::info('Build has been canceled'); + return; + } + + // Color message red + $message = $th->getMessage(); + if (!\str_contains($message, '')) { + $message = "" . $message; + } + + $separator = \strpos($message, '{APPWRITE_DETECTION_SEPARATOR_START}'); + if ($separator !== false) { + $error = \substr($message, $separator + strlen('{APPWRITE_DETECTION_SEPARATOR_START}')); + $message = \substr($message, 0, $separator); + $message .= "\n" . $error; + } + + $endTime = DateTime::now(); + $durationEnd = \microtime(true); + $deployment->setAttribute('buildEndedAt', $endTime); + $deployment->setAttribute('buildDuration', \intval(\ceil($durationEnd - $durationStart))); + $deployment->setAttribute('status', 'failed'); + $deployment->setAttribute('buildLogs', $message); + + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment); + + if ($deployment->getInternalId() === $resource->getAttribute('latestDeploymentInternalId', '')) { + $resource = $resource->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument($resource->getCollection(), $resource->getId(), $resource); + } + + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + if ($isVcsEnabled) { + $this->runGitAction('failed', $github, $providerCommitHash, $owner, $repositoryName, $project, $resource, $deployment->getId(), $dbForProject, $dbForPlatform); + } + } finally { + $queueForRealtime + ->setPayload($deployment->getArrayCopy()) + ->trigger(); + + $this->sendUsage( + resource:$resource, + deployment: $deployment, + project: $project, + queue: $queueForStatsUsage + ); + } + } + + protected function sendUsage(Document $resource, Document $deployment, Document $project, StatsUsage $queue): void + { + switch ($deployment->getAttribute('status')) { + case 'ready': + $queue + ->addMetric(METRIC_BUILDS_SUCCESS, 1) // per project + ->addMetric(METRIC_BUILDS_COMPUTE_SUCCESS, (int)$deployment->getAttribute('buildDuration', 0) * 1000) + ->addMetric(str_replace(['{resourceType}'], [$deployment->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_BUILDS_SUCCESS), 1) // per function + ->addMetric(str_replace(['{resourceType}'], [$deployment->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_BUILDS_COMPUTE_SUCCESS), (int)$deployment->getAttribute('buildDuration', 0) * 1000) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$deployment->getAttribute('resourceType'), $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_SUCCESS), 1) // per function + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$deployment->getAttribute('resourceType'), $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_COMPUTE_SUCCESS), (int)$deployment->getAttribute('buildDuration', 0) * 1000); + break; + case 'failed': + $queue + ->addMetric(METRIC_BUILDS_FAILED, 1) // per project + ->addMetric(METRIC_BUILDS_COMPUTE_FAILED, (int)$deployment->getAttribute('buildDuration', 0) * 1000) + ->addMetric(str_replace(['{resourceType}'], [$deployment->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_BUILDS_FAILED), 1) // per function + ->addMetric(str_replace(['{resourceType}'], [$deployment->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_BUILDS_COMPUTE_FAILED), (int)$deployment->getAttribute('buildDuration', 0) * 1000) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$deployment->getAttribute('resourceType'), $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_FAILED), 1) // per function + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$deployment->getAttribute('resourceType'), $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_COMPUTE_FAILED), (int)$deployment->getAttribute('buildDuration', 0) * 1000); + break; + } + + $queue + ->addMetric(METRIC_BUILDS, 1) // per project + ->addMetric(METRIC_BUILDS_STORAGE, $deployment->getAttribute('buildSize', 0)) + ->addMetric(METRIC_BUILDS_COMPUTE, (int)$deployment->getAttribute('buildDuration', 0) * 1000) + ->addMetric(METRIC_BUILDS_MB_SECONDS, (int)(($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT) * $deployment->getAttribute('buildDuration', 0) * ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT))) + ->addMetric(str_replace(['{resourceType}'], [$deployment->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_BUILDS), 1) // per function + ->addMetric(str_replace(['{resourceType}'], [$deployment->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_BUILDS_STORAGE), $deployment->getAttribute('buildSize', 0)) + ->addMetric(str_replace(['{resourceType}'], [$deployment->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_BUILDS_COMPUTE), (int)$deployment->getAttribute('buildDuration', 0) * 1000) + ->addMetric(str_replace(['{resourceType}'], [$deployment->getAttribute('resourceType')], METRIC_RESOURCE_TYPE_BUILDS_MB_SECONDS), (int)(($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT) * $deployment->getAttribute('buildDuration', 0) * ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT))) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$deployment->getAttribute('resourceType'), $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS), 1) // per function + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$deployment->getAttribute('resourceType'), $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_STORAGE), $deployment->getAttribute('buildSize', 0)) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$deployment->getAttribute('resourceType'), $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_COMPUTE), (int)$deployment->getAttribute('buildDuration', 0) * 1000) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [$deployment->getAttribute('resourceType'), $resource->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_MB_SECONDS), (int)(($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT) * $deployment->getAttribute('buildDuration', 0) * ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT))) + ->setProject($project) + ->trigger(); + } + + protected function getRuntime(Document $resource, string $version): array + { + $runtimes = Config::getParam($version === 'v2' ? 'runtimes-v2' : 'runtimes', []); + $key = $resource->getAttribute('runtime'); + $runtime = match ($resource->getCollection()) { + 'functions' => $runtimes[$resource->getAttribute('runtime')] ?? null, + 'sites' => $runtimes[$resource->getAttribute('buildRuntime')] ?? null, + default => null + }; + if (\is_null($runtime)) { + throw new \Exception('Runtime "' . $resource->getAttribute('runtime', '') . '" is not supported'); + } + + return $runtime; + } + + protected function getVersion(Document $resource): string + { + return match ($resource->getCollection()) { + 'functions' => $resource->getAttribute('version', 'v2'), + 'sites' => 'v5', + }; + } + + protected function getCommand(Document $resource, Document $deployment): string + { + if ($resource->getCollection() === 'functions') { + return $deployment->getAttribute('buildCommands', ''); + } elseif ($resource->getCollection() === 'sites') { + $commands = []; + + $frameworks = Config::getParam('frameworks', []); + $framework = $frameworks[$resource->getAttribute('framework', '')] ?? null; + + $envCommand = ''; + $bundleCommand = ''; + if (!is_null($framework)) { + $envCommand = $framework['envCommand'] ?? ''; + $bundleCommand = $framework['bundleCommand'] ?? ''; + } + + $commands[] = $envCommand; + $commands[] = $deployment->getAttribute('buildCommands', ''); + $commands[] = $bundleCommand; + + $commands = array_filter($commands, fn ($command) => !empty($command)); + + return implode(' && ', $commands); + } + + return ''; + } + + /** + * @param string $status + * @param GitHub $github + * @param string $providerCommitHash + * @param string $owner + * @param string $repositoryName + * @param Document $project + * @param Document $resource + * @param string $deploymentId + * @param Database $dbForProject + * @param Database $dbForPlatform + * @return void + * @throws Structure + * @throws \Utopia\Database\Exception + * @throws Authorization + * @throws Conflict + * @throws Restricted + */ + protected function runGitAction( + string $status, + GitHub $github, + string $providerCommitHash, + string $owner, + string $repositoryName, + Document $project, + Document $resource, + string $deploymentId, + Database $dbForProject, + Database $dbForPlatform + ): void { + if ($resource->getAttribute('providerSilentMode', false) === true) { + return; + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + $commentId = $deployment->getAttribute('providerCommentId', ''); + + if (!empty($providerCommitHash)) { + $message = match ($status) { + 'ready' => 'Build succeeded.', + 'failed' => 'Build failed.', + 'processing' => 'Building...', + default => $status + }; + + $state = match ($status) { + 'ready' => 'success', + 'failed' => 'failure', + 'processing' => 'pending', + default => $status + }; + + $resourceName = $resource->getAttribute('name'); + $projectName = $project->getAttribute('name'); + + $name = "{$resourceName} ({$projectName})"; + + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $hostname = System::getEnv('_APP_DOMAIN'); + + $projectId = $project->getId(); + $resourceId = $resource->getId(); + $providerTargetUrl = match ($resource->getCollection()) { + 'functions' => "{$protocol}://{$hostname}/console/project-{$projectId}/functions/function-{$resourceId}", + 'sites' => "{$protocol}://{$hostname}/console/project-{$projectId}/sites/site-{$resourceId}", + default => throw new \Exception('Invalid resource type') + }; + + $github->updateCommitStatus($repositoryName, $providerCommitHash, $owner, $state, $message, $providerTargetUrl, $name); + } + + if (!empty($commentId)) { + $retries = 0; + + while (true) { + $retries++; + + try { + $dbForPlatform->createDocument('vcsCommentLocks', new Document([ + '$id' => $commentId + ])); + break; + } catch (\Throwable $err) { + if ($retries >= 9) { + throw $err; + } + + \sleep(1); + } + } + + // Wrap in try/finally to ensure lock file gets deleted + try { + $resourceType = match($resource->getCollection()) { + 'functions' => 'function', + 'sites' => 'site', + default => throw new \Exception('Invalid resource type') + }; + + $rule = Authorization::skip(fn () => $dbForPlatform->findOne('rules', [ + Query::equal("projectInternalId", [$project->getInternalId()]), + Query::equal("type", ["deployment"]), + Query::equal("deploymentInternalId", [$deployment->getInternalId()]), + ])); + + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $previewUrl = match($resource->getCollection()) { + 'functions' => '', + 'sites' => !empty($rule) ? ("{$protocol}://" . $rule->getAttribute('domain', '')) : '', + default => throw new \Exception('Invalid resource type') + }; + + $comment = new Comment(); + $comment->parseComment($github->getComment($owner, $repositoryName, $commentId)); + $comment->addBuild($project, $resource, $resourceType, $status, $deployment->getId(), ['type' => 'logs'], $previewUrl); + $github->updateComment($owner, $repositoryName, $commentId, $comment->generateComment()); + } finally { + $dbForPlatform->deleteDocument('vcsCommentLocks', $commentId); + } + } + } + + protected function listRules(Document $project, array $queries, Database $database, callable $callback): void + { + $limit = 100; + $cursor = null; + + do { + $queries = \array_merge([ + Query::limit($limit), + Query::equal("projectInternalId", [$project->getInternalId()]) + ], $queries); + + if ($cursor !== null) { + $queries[] = Query::cursorAfter($cursor); + } + + $results = $database->find('rules', $queries); + + $total = \count($results); + if ($total > 0) { + $cursor = $results[$total - 1]; + } + + if ($total < $limit) { + $cursor = null; + } + + foreach ($results as $document) { + if (is_callable($callback)) { + $callback($document); + } + } + } while (!\is_null($cursor)); + } +} diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php new file mode 100644 index 0000000000..43f7d4ac02 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Create.php @@ -0,0 +1,96 @@ +<?php + +namespace Appwrite\Platform\Modules\Projects\Http\DevKeys; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\Datetime as DatetimeValidator; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Text; + +class Create extends Action +{ + use HTTP; + public static function getName() + { + return 'createDevKey'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/projects/:projectId/dev-keys') + ->desc('Create dev key') + ->groups(['api', 'projects']) + ->label('scope', 'projects.write') + ->label('sdk', new Method( + namespace: 'projects', + group: 'devKeys', + name: 'createDevKey', + description: <<<EOT + Create a new project dev key. Dev keys are project specific and allow you to bypass rate limits and get better error logging during development. Strictly meant for development purposes only. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_DEV_KEY + ) + ], + contentType: ContentType::JSON + )) + ->param('projectId', '', new UID(), 'Project unique ID.') + ->param('name', null, new Text(128), 'Key name. Max length: 128 chars.') + ->param('expire', null, new DatetimeValidator(), 'Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.', false) + ->inject('user') + ->inject('response') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action(string $projectId, string $name, ?string $expire, Document $user, Response $response, Database $dbForPlatform) + { + $project = $dbForPlatform->getDocument('projects', $projectId); + + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } + + $devKeyId = ID::unique(); + $key = new Document([ + '$id' => $devKeyId, + '$permissions' => [ + Permission::read(Role::user($user->getId())), + Permission::update(Role::user($user->getId())), + Permission::delete(Role::user($user->getId())), + ], + 'projectInternalId' => $project->getInternalId(), + 'projectId' => $project->getId(), + 'name' => $name, + 'expire' => $expire, + 'sdks' => [], + 'accessedAt' => null, + 'secret' => \bin2hex(\random_bytes(128)), + ]); + + $key = $dbForPlatform->createDocument('devKeys', $key); + + $dbForPlatform->purgeCachedDocument('projects', $project->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($key, Response::MODEL_DEV_KEY); + } +} diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php new file mode 100644 index 0000000000..f6cb966f50 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Delete.php @@ -0,0 +1,76 @@ +<?php + +namespace Appwrite\Platform\Modules\Projects\Http\DevKeys; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Delete extends Action +{ + use HTTP; + public static function getName() + { + return 'deleteDevKey'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/projects/:projectId/dev-keys/:keyId') + ->desc('Delete dev key') + ->groups(['api', 'projects']) + ->label('scope', 'projects.write') + ->label('sdk', new Method( + namespace: 'projects', + group: 'devKeys', + name: 'deleteDevKey', + description: <<<EOT + Delete a project\'s dev key by its unique ID. Once deleted, the key will no longer allow bypassing of rate limits and better logging of errors. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE + ) + ], + contentType: ContentType::NONE + )) + ->param('projectId', '', new UID(), 'Project unique ID.') + ->param('keyId', '', new UID(), 'Key unique ID.') + ->inject('response') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action(string $projectId, string $keyId, Response $response, Database $dbForPlatform) + { + + $project = $dbForPlatform->getDocument('projects', $projectId); + + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } + + $key = $dbForPlatform->getDocument('devKeys', $keyId); + + if ($key === false || $key->isEmpty() || $key->getAttribute('projectInternalId') !== $project->getInternalId()) { + throw new Exception(Exception::KEY_NOT_FOUND); + } + + $dbForPlatform->deleteDocument('devKeys', $key->getId()); + + $dbForPlatform->purgeCachedDocument('projects', $project->getId()); + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php new file mode 100644 index 0000000000..bd472b26e7 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Get.php @@ -0,0 +1,72 @@ +<?php + +namespace Appwrite\Platform\Modules\Projects\Http\DevKeys; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Action +{ + use HTTP; + public static function getName() + { + return 'getDevKey'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/projects/:projectId/dev-keys/:keyId') + ->desc('Get dev key') + ->groups(['api', 'projects']) + ->label('scope', 'projects.read') + ->label('sdk', new Method( + namespace: 'projects', + group: 'devKeys', + name: 'getDevKey', + description: <<<EOT + Get a project\'s dev key by its unique ID. Dev keys are project specific and allow you to bypass rate limits and get better error logging during development. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_DEV_KEY + ) + ], + contentType: ContentType::JSON + )) + ->param('projectId', '', new UID(), 'Project unique ID.') + ->param('keyId', '', new UID(), 'Key unique ID.') + ->inject('response') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action(string $projectId, string $keyId, Response $response, Database $dbForPlatform) + { + + $project = $dbForPlatform->getDocument('projects', $projectId); + + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } + + $key = $dbForPlatform->getDocument('devKeys', $keyId); + + if ($key === false || $key->isEmpty() || $key->getAttribute('projectInternalId') !== $project->getInternalId()) { + throw new Exception(Exception::KEY_NOT_FOUND); + } + + $response->dynamic($key, Response::MODEL_DEV_KEY); + } +} diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php new file mode 100644 index 0000000000..d5e6839174 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/Update.php @@ -0,0 +1,82 @@ +<?php + +namespace Appwrite\Platform\Modules\Projects\Http\DevKeys; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\Datetime as DatetimeValidator; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Text; + +class Update extends Action +{ + use HTTP; + public static function getName() + { + return 'updateDevKey'; + } + + public function __construct() + { + $this->setHttpMethod(Action::HTTP_REQUEST_METHOD_PUT) + ->setHttpPath('/v1/projects/:projectId/dev-keys/:keyId') + ->desc('Update dev key') + ->groups(['api', 'projects']) + ->label('scope', 'projects.write') + ->label('sdk', new Method( + namespace: 'projects', + group: 'devKeys', + name: 'updateDevKey', + description: <<<EOT + Update a project\'s dev key by its unique ID. Use this endpoint to update a project\'s dev key name or expiration time.' + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_DEV_KEY + ) + ], + contentType: ContentType::JSON + )) + ->param('projectId', '', new UID(), 'Project unique ID.') + ->param('keyId', '', new UID(), 'Key unique ID.') + ->param('name', null, new Text(128), 'Key name. Max length: 128 chars.') + ->param('expire', null, new DatetimeValidator(), 'Expiration time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.') + ->inject('response') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + public function action(string $projectId, string $keyId, string $name, ?string $expire, Response $response, Database $dbForPlatform) + { + + $project = $dbForPlatform->getDocument('projects', $projectId); + + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } + + $key = $dbForPlatform->getDocument('devKeys', $keyId); + + if ($key === false || $key->isEmpty() || $key->getAttribute('projectInternalId') !== $project->getInternalId()) { + throw new Exception(Exception::KEY_NOT_FOUND); + } + + $key + ->setAttribute('name', $name) + ->setAttribute('expire', $expire); + + $dbForPlatform->updateDocument('devKeys', $key->getId(), $key); + + $dbForPlatform->purgeCachedDocument('projects', $project->getId()); + + $response->dynamic($key, Response::MODEL_DEV_KEY); + } +} diff --git a/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php new file mode 100644 index 0000000000..864531d32d --- /dev/null +++ b/src/Appwrite/Platform/Modules/Projects/Http/DevKeys/XList.php @@ -0,0 +1,83 @@ +<?php + +namespace Appwrite\Platform\Modules\Projects\Http\DevKeys; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\Queries\DevKeys; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Query as QueryException; +use Utopia\Database\Query; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class XList extends Action +{ + use HTTP; + public static function getName() + { + return 'listDevKeys'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/projects/:projectId/dev-keys') + ->desc('List dev keys') + ->groups(['api', 'projects']) + ->label('scope', 'projects.read') + ->label('sdk', new Method( + namespace: 'projects', + group: 'devKeys', + name: 'listDevKeys', + description: <<<EOT + List all the project\'s dev keys. Dev keys are project specific and allow you to bypass rate limits and get better error logging during development.' + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_DEV_KEY_LIST + ) + ], + contentType: ContentType::JSON + )) + ->param('projectId', '', new UID(), 'Project unique ID.') + ->param('queries', [], new DevKeys(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', DevKeys::ALLOWED_ATTRIBUTES), true) + ->inject('response') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action(string $projectId, ?array $queries, Response $response, Database $dbForPlatform) + { + + $project = $dbForPlatform->getDocument('projects', $projectId); + + if ($project->isEmpty()) { + throw new Exception(Exception::PROJECT_NOT_FOUND); + } + + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + $queries[] = Query::equal('projectInternalId', [$project->getInternalId()]); + + $keys = $dbForPlatform->find('devKeys', $queries); + + $response->dynamic(new Document([ + 'devKeys' => $keys, + 'total' => count($keys), + ]), Response::MODEL_DEV_KEY_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Projects/Module.php b/src/Appwrite/Platform/Modules/Projects/Module.php new file mode 100644 index 0000000000..2a550acf54 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Projects/Module.php @@ -0,0 +1,14 @@ +<?php + +namespace Appwrite\Platform\Modules\Projects; + +use Appwrite\Platform\Modules\Projects\Services\Http; +use Utopia\Platform\Module as Base; + +class Module extends Base +{ + public function __construct() + { + $this->addService('http', new Http()); + } +} diff --git a/src/Appwrite/Platform/Modules/Projects/Services/Http.php b/src/Appwrite/Platform/Modules/Projects/Services/Http.php new file mode 100644 index 0000000000..cec8ed6d16 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Projects/Services/Http.php @@ -0,0 +1,23 @@ +<?php + +namespace Appwrite\Platform\Modules\Projects\Services; + +use Appwrite\Platform\Modules\Projects\Http\DevKeys\Create as CreateDevKey; +use Appwrite\Platform\Modules\Projects\Http\DevKeys\Delete as DeleteDevKey; +use Appwrite\Platform\Modules\Projects\Http\DevKeys\Get as GetDevKey; +use Appwrite\Platform\Modules\Projects\Http\DevKeys\Update as UpdateDevKey; +use Appwrite\Platform\Modules\Projects\Http\DevKeys\XList as ListDevKeys; +use Utopia\Platform\Service; + +class Http extends Service +{ + public function __construct() + { + $this->type = Service::TYPE_HTTP; + $this->addAction(CreateDevKey::getName(), new CreateDevKey()); + $this->addAction(UpdateDevKey::getName(), new UpdateDevKey()); + $this->addAction(GetDevKey::getName(), new GetDevKey()); + $this->addAction(ListDevKeys::getName(), new ListDevKeys()); + $this->addAction(DeleteDevKey::getName(), new DeleteDevKey()); + } +} diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php new file mode 100644 index 0000000000..443a5db35e --- /dev/null +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/API/Create.php @@ -0,0 +1,187 @@ +<?php + +namespace Appwrite\Platform\Modules\Proxy\Http\Rules\API; + +use Appwrite\Event\Certificate; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Network\Validator\DNS; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Duplicate; +use Utopia\Database\Helpers\ID; +use Utopia\Domains\Domain; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\System\System; +use Utopia\Validator\AnyOf; +use Utopia\Validator\Domain as ValidatorDomain; +use Utopia\Validator\IP; + +class Create extends Action +{ + use HTTP; + + public static function getName() + { + return 'createAPIRule'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/proxy/rules/api') + ->groups(['api', 'proxy']) + ->desc('Create API rule') + ->label('scope', 'rules.write') + ->label('event', 'rules.[ruleId].create') + ->label('audits.event', 'rule.create') + ->label('audits.resource', 'rule/{response.$id}') + ->label('sdk', new Method( + namespace: 'proxy', + group: null, + name: 'createAPIRule', + description: <<<EOT + Create a new proxy rule for serving Appwrite's API on custom domain. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_PROXY_RULE, + ) + ] + )) + ->label('abuse-limit', 10) + ->label('abuse-key', 'userId:{userId}, url:{url}') + ->label('abuse-time', 60) + ->param('domain', null, new ValidatorDomain(), 'Domain name.') + ->inject('response') + ->inject('project') + ->inject('queueForCertificates') + ->inject('queueForEvents') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action(string $domain, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform) + { + $deniedDomains = [ + 'localhost', + APP_HOSTNAME_INTERNAL + ]; + + $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $deniedDomains[] = $mainDomain; + + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + if (!empty($sitesDomain)) { + $deniedDomains[] = $sitesDomain; + } + + $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); + if (!empty($functionsDomain)) { + $deniedDomains[] = $functionsDomain; + } + + $denyListDomains = System::getEnv('_APP_CUSTOM_DOMAIN_DENY_LIST', ''); + $denyListDomains = \array_map('trim', explode(',', $denyListDomains)); + foreach ($denyListDomains as $denyListDomain) { + if (empty($denyListDomain)) { + continue; + } + $deniedDomains[] = $denyListDomain; + } + + if (\in_array($domain, $deniedDomains)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.'); + } + + if (\str_starts_with($domain, 'commit-') || \str_starts_with($domain, 'branch-')) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.'); + } + + try { + $domain = new Domain($domain); + } catch (\Throwable) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Domain may not start with http:// or https://.'); + } + + // TODO: @christyjacob remove once we migrate the rules in 1.7.x + $ruleId = System::getEnv('_APP_RULES_FORMAT') === 'md5' ? md5($domain->get()) : ID::unique(); + + $status = 'created'; + if (\str_ends_with($domain->get(), $functionsDomain) || \str_ends_with($domain->get(), $sitesDomain)) { + $status = 'verified'; + } + if ($status === 'created') { + $validators = []; + $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); + if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); + } + if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), DNS::RECORD_A); + } + if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), DNS::RECORD_AAAA); + } + + if (empty($validators)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'At least one of domain targets environment variable must be configured.'); + } + + $validator = new AnyOf($validators, AnyOf::TYPE_STRING); + if ($validator->isValid($domain->get())) { + $status = 'verifying'; + } + } + + $owner = ''; + if ( + ($functionsDomain != '' && \str_ends_with($domain->get(), $functionsDomain)) || + ($sitesDomain != '' && \str_ends_with($domain->get(), $sitesDomain)) + ) { + $owner = 'Appwrite'; + } + + $rule = new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain->get(), + 'status' => $status, + 'type' => 'api', + 'trigger' => 'manual', + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain->get()]), + 'owner' => $owner, + 'region' => $project->getAttribute('region') + ]); + + try { + $rule = $dbForPlatform->createDocument('rules', $rule); + } catch (Duplicate $e) { + throw new Exception(Exception::RULE_ALREADY_EXISTS); + } + + if ($rule->getAttribute('status', '') === 'verifying') { + $queueForCertificates + ->setDomain(new Document([ + 'domain' => $rule->getAttribute('domain') + ])) + ->trigger(); + } + + $queueForEvents->setParam('ruleId', $rule->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($rule, Response::MODEL_PROXY_RULE); + } +} diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php new file mode 100644 index 0000000000..039f583150 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Function/Create.php @@ -0,0 +1,205 @@ +<?php + +namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Function; + +use Appwrite\Event\Certificate; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Network\Validator\DNS; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Duplicate; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\UID; +use Utopia\Domains\Domain; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\System\System; +use Utopia\Validator\AnyOf; +use Utopia\Validator\Domain as ValidatorDomain; +use Utopia\Validator\IP; +use Utopia\Validator\Text; + +class Create extends Action +{ + use HTTP; + + public static function getName() + { + return 'createFunctionRule'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/proxy/rules/function') + ->groups(['api', 'proxy']) + ->desc('Create function rule') + ->label('scope', 'rules.write') + ->label('event', 'rules.[ruleId].create') + ->label('audits.event', 'rule.create') + ->label('audits.resource', 'rule/{response.$id}') + ->label('sdk', new Method( + namespace: 'proxy', + group: null, + name: 'createFunctionRule', + description: <<<EOT + Create a new proxy rule for executing Appwrite Function on custom domain. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_PROXY_RULE, + ) + ] + )) + ->label('abuse-limit', 10) + ->label('abuse-key', 'userId:{userId}, url:{url}') + ->label('abuse-time', 60) + ->param('domain', null, new ValidatorDomain(), 'Domain name.') + ->param('functionId', '', new UID(), 'ID of function to be executed.') + ->param('branch', '', new Text(255, 0), 'Name of VCS branch to deploy changes automatically', true) + ->inject('response') + ->inject('project') + ->inject('queueForCertificates') + ->inject('queueForEvents') + ->inject('dbForPlatform') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $domain, string $functionId, string $branch, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform, Database $dbForProject) + { + $deniedDomains = [ + 'localhost', + APP_HOSTNAME_INTERNAL + ]; + + $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $deniedDomains[] = $mainDomain; + + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + if (!empty($sitesDomain)) { + $deniedDomains[] = $sitesDomain; + } + + $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); + if (!empty($functionsDomain)) { + $deniedDomains[] = $functionsDomain; + } + + $denyListDomains = System::getEnv('_APP_CUSTOM_DOMAIN_DENY_LIST', ''); + $denyListDomains = \array_map('trim', explode(',', $denyListDomains)); + foreach ($denyListDomains as $denyListDomain) { + if (empty($denyListDomain)) { + continue; + } + $deniedDomains[] = $denyListDomain; + } + + if (\in_array($domain, $deniedDomains)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.'); + } + + if (\str_starts_with($domain, 'commit-') || \str_starts_with($domain, 'branch-')) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.'); + } + + try { + $domain = new Domain($domain); + } catch (\Throwable) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Domain may not start with http:// or https://.'); + } + + $function = $dbForProject->getDocument('functions', $functionId); + if ($function->isEmpty()) { + throw new Exception(Exception::RULE_RESOURCE_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $function->getAttribute('deploymentId', '')); + + // TODO: @christyjacob remove once we migrate the rules in 1.7.x + $ruleId = System::getEnv('_APP_RULES_FORMAT') === 'md5' ? md5($domain->get()) : ID::unique(); + + $status = 'created'; + if (\str_ends_with($domain->get(), $functionsDomain) || \str_ends_with($domain->get(), $sitesDomain)) { + $status = 'verified'; + } + if ($status === 'created') { + $validators = []; + $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); + if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); + } + if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), DNS::RECORD_A); + } + if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), DNS::RECORD_AAAA); + } + + if (empty($validators)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'At least one of domain targets environment variable must be configured.'); + } + + $validator = new AnyOf($validators, AnyOf::TYPE_STRING); + if ($validator->isValid($domain->get())) { + $status = 'verifying'; + } + } + + $owner = ''; + if ( + ($functionsDomain != '' && \str_ends_with($domain->get(), $functionsDomain)) || + ($sitesDomain != '' && \str_ends_with($domain->get(), $sitesDomain)) + ) { + $owner = 'Appwrite'; + } + + $rule = new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain->get(), + 'status' => $status, + 'type' => 'deployment', + 'trigger' => 'manual', + 'deploymentId' => $deployment->isEmpty() ? '' : $deployment->getId(), + 'deploymentInternalId' => $deployment->isEmpty() ? '' : $deployment->getInternalId(), + 'deploymentResourceType' => 'function', + 'deploymentResourceId' => $function->getId(), + 'deploymentResourceInternalId' => $function->getInternalId(), + 'deploymentVcsProviderBranch' => $branch, + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain->get(), $branch]), + 'owner' => $owner, + 'region' => $project->getAttribute('region') + ]); + + try { + $rule = $dbForPlatform->createDocument('rules', $rule); + } catch (Duplicate $e) { + throw new Exception(Exception::RULE_ALREADY_EXISTS); + } + + if ($rule->getAttribute('status', '') === 'verifying') { + $queueForCertificates + ->setDomain(new Document([ + 'domain' => $rule->getAttribute('domain') + ])) + ->trigger(); + } + + $queueForEvents->setParam('ruleId', $rule->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($rule, Response::MODEL_PROXY_RULE); + } +} diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php new file mode 100644 index 0000000000..a693e3ec30 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Redirect/Create.php @@ -0,0 +1,193 @@ +<?php + +namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Redirect; + +use Appwrite\Event\Certificate; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Network\Validator\DNS; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Duplicate; +use Utopia\Database\Helpers\ID; +use Utopia\Domains\Domain; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\System\System; +use Utopia\Validator\AnyOf; +use Utopia\Validator\Domain as ValidatorDomain; +use Utopia\Validator\IP; +use Utopia\Validator\URL; +use Utopia\Validator\WhiteList; + +class Create extends Action +{ + use HTTP; + + public static function getName() + { + return 'createRedirectRule'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/proxy/rules/redirect') + ->groups(['api', 'proxy']) + ->desc('Create Redirect rule') + ->label('scope', 'rules.write') + ->label('event', 'rules.[ruleId].create') + ->label('audits.event', 'rule.create') + ->label('audits.resource', 'rule/{response.$id}') + ->label('sdk', new Method( + namespace: 'proxy', + group: null, + name: 'createRedirectRule', + description: <<<EOT + Create a new proxy rule for to redirect from custom domain to another domain. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_PROXY_RULE, + ) + ] + )) + ->label('abuse-limit', 10) + ->label('abuse-key', 'userId:{userId}, url:{url}') + ->label('abuse-time', 60) + ->param('domain', null, new ValidatorDomain(), 'Domain name.') + ->param('url', null, new URL(), 'Target URL of redirection') + ->param('statusCode', null, new WhiteList([301, 302, 307, 308]), 'Status code of redirection') + ->inject('response') + ->inject('project') + ->inject('queueForCertificates') + ->inject('queueForEvents') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action(string $domain, string $url, int $statusCode, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform) + { + $deniedDomains = [ + 'localhost', + APP_HOSTNAME_INTERNAL + ]; + + $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $deniedDomains[] = $mainDomain; + + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + if (!empty($sitesDomain)) { + $deniedDomains[] = $sitesDomain; + } + + $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); + if (!empty($functionsDomain)) { + $deniedDomains[] = $functionsDomain; + } + + $denyListDomains = System::getEnv('_APP_CUSTOM_DOMAIN_DENY_LIST', ''); + $denyListDomains = \array_map('trim', explode(',', $denyListDomains)); + foreach ($denyListDomains as $denyListDomain) { + if (empty($denyListDomain)) { + continue; + } + $deniedDomains[] = $denyListDomain; + } + + if (\in_array($domain, $deniedDomains)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.'); + } + + if (\str_starts_with($domain, 'commit-') || \str_starts_with($domain, 'branch-')) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.'); + } + + try { + $domain = new Domain($domain); + } catch (\Throwable) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Domain may not start with http:// or https://.'); + } + + // TODO: @christyjacob remove once we migrate the rules in 1.7.x + $ruleId = System::getEnv('_APP_RULES_FORMAT') === 'md5' ? md5($domain->get()) : ID::unique(); + + $status = 'created'; + if (\str_ends_with($domain->get(), $functionsDomain) || \str_ends_with($domain->get(), $sitesDomain)) { + $status = 'verified'; + } + if ($status === 'created') { + $validators = []; + $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); + if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); + } + if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), DNS::RECORD_A); + } + if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), DNS::RECORD_AAAA); + } + + if (empty($validators)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'At least one of domain targets environment variable must be configured.'); + } + + $validator = new AnyOf($validators, AnyOf::TYPE_STRING); + if ($validator->isValid($domain->get())) { + $status = 'verifying'; + } + } + + $owner = ''; + if ( + ($functionsDomain != '' && \str_ends_with($domain->get(), $functionsDomain)) || + ($sitesDomain != '' && \str_ends_with($domain->get(), $sitesDomain)) + ) { + $owner = 'Appwrite'; + } + + $rule = new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain->get(), + 'status' => $status, + 'type' => 'redirect', + 'trigger' => 'manual', + 'redirectUrl' => $url, + 'redirectStatusCode' => $statusCode, + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain->get()]), + 'owner' => $owner, + 'region' => $project->getAttribute('region') + ]); + + try { + $rule = $dbForPlatform->createDocument('rules', $rule); + } catch (Duplicate $e) { + throw new Exception(Exception::RULE_ALREADY_EXISTS); + } + + if ($rule->getAttribute('status', '') === 'verifying') { + $queueForCertificates + ->setDomain(new Document([ + 'domain' => $rule->getAttribute('domain') + ])) + ->trigger(); + } + + $queueForEvents->setParam('ruleId', $rule->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($rule, Response::MODEL_PROXY_RULE); + } +} diff --git a/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php new file mode 100644 index 0000000000..ac55b709e8 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Proxy/Http/Rules/Site/Create.php @@ -0,0 +1,205 @@ +<?php + +namespace Appwrite\Platform\Modules\Proxy\Http\Rules\Site; + +use Appwrite\Event\Certificate; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Network\Validator\DNS; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Duplicate; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\UID; +use Utopia\Domains\Domain; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\System\System; +use Utopia\Validator\AnyOf; +use Utopia\Validator\Domain as ValidatorDomain; +use Utopia\Validator\IP; +use Utopia\Validator\Text; + +class Create extends Action +{ + use HTTP; + + public static function getName() + { + return 'createSiteRule'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/proxy/rules/site') + ->groups(['api', 'proxy']) + ->desc('Create site rule') + ->label('scope', 'rules.write') + ->label('event', 'rules.[ruleId].create') + ->label('audits.event', 'rule.create') + ->label('audits.resource', 'rule/{response.$id}') + ->label('sdk', new Method( + namespace: 'proxy', + group: null, + name: 'createSiteRule', + description: <<<EOT + Create a new proxy rule for serving Appwrite Site on custom domain. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_PROXY_RULE, + ) + ] + )) + ->label('abuse-limit', 10) + ->label('abuse-key', 'userId:{userId}, url:{url}') + ->label('abuse-time', 60) + ->param('domain', null, new ValidatorDomain(), 'Domain name.') + ->param('siteId', '', new UID(), 'ID of site to be executed.') + ->param('branch', '', new Text(255, 0), 'Name of VCS branch to deploy changes automatically', true) + ->inject('response') + ->inject('project') + ->inject('queueForCertificates') + ->inject('queueForEvents') + ->inject('dbForPlatform') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $domain, string $siteId, string $branch, Response $response, Document $project, Certificate $queueForCertificates, Event $queueForEvents, Database $dbForPlatform, Database $dbForProject) + { + $deniedDomains = [ + 'localhost', + APP_HOSTNAME_INTERNAL + ]; + + $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $deniedDomains[] = $mainDomain; + + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + if (!empty($sitesDomain)) { + $deniedDomains[] = $sitesDomain; + } + + $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); + if (!empty($functionsDomain)) { + $deniedDomains[] = $functionsDomain; + } + + $denyListDomains = System::getEnv('_APP_CUSTOM_DOMAIN_DENY_LIST', ''); + $denyListDomains = \array_map('trim', explode(',', $denyListDomains)); + foreach ($denyListDomains as $denyListDomain) { + if (empty($denyListDomain)) { + continue; + } + $deniedDomains[] = $denyListDomain; + } + + if (\in_array($domain, $deniedDomains)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.'); + } + + if (\str_starts_with($domain, 'commit-') || \str_starts_with($domain, 'branch-')) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed. Please use a different domain.'); + } + + try { + $domain = new Domain($domain); + } catch (\Throwable) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Domain may not start with http:// or https://.'); + } + + $site = $dbForProject->getDocument('sites', $siteId); + if ($site->isEmpty()) { + throw new Exception(Exception::RULE_RESOURCE_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $site->getAttribute('deploymentId', '')); + + // TODO: @christyjacob remove once we migrate the rules in 1.7.x + $ruleId = System::getEnv('_APP_RULES_FORMAT') === 'md5' ? md5($domain->get()) : ID::unique(); + + $status = 'created'; + if (\str_ends_with($domain->get(), $functionsDomain) || \str_ends_with($domain->get(), $sitesDomain)) { + $status = 'verified'; + } + if ($status === 'created') { + $validators = []; + $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); + if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); + } + if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), DNS::RECORD_A); + } + if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), DNS::RECORD_AAAA); + } + + if (empty($validators)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'At least one of domain targets environment variable must be configured.'); + } + + $validator = new AnyOf($validators, AnyOf::TYPE_STRING); + if ($validator->isValid($domain->get())) { + $status = 'verifying'; + } + } + + $owner = ''; + if ( + ($functionsDomain != '' && \str_ends_with($domain->get(), $functionsDomain)) || + ($sitesDomain != '' && \str_ends_with($domain->get(), $sitesDomain)) + ) { + $owner = 'Appwrite'; + } + + $rule = new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain->get(), + 'status' => $status, + 'type' => 'deployment', + 'trigger' => 'manual', + 'deploymentId' => $deployment->isEmpty() ? '' : $deployment->getId(), + 'deploymentInternalId' => $deployment->isEmpty() ? '' : $deployment->getInternalId(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $site->getId(), + 'deploymentResourceInternalId' => $site->getInternalId(), + 'deploymentVcsProviderBranch' => $branch, + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain->get(), $branch]), + 'owner' => $owner, + 'region' => $project->getAttribute('region') + ]); + + try { + $rule = $dbForPlatform->createDocument('rules', $rule); + } catch (Duplicate $e) { + throw new Exception(Exception::RULE_ALREADY_EXISTS); + } + + if ($rule->getAttribute('status', '') === 'verifying') { + $queueForCertificates + ->setDomain(new Document([ + 'domain' => $rule->getAttribute('domain') + ])) + ->trigger(); + } + + $queueForEvents->setParam('ruleId', $rule->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($rule, Response::MODEL_PROXY_RULE); + } +} diff --git a/src/Appwrite/Platform/Modules/Proxy/Module.php b/src/Appwrite/Platform/Modules/Proxy/Module.php new file mode 100644 index 0000000000..cd8f6f86dc --- /dev/null +++ b/src/Appwrite/Platform/Modules/Proxy/Module.php @@ -0,0 +1,14 @@ +<?php + +namespace Appwrite\Platform\Modules\Proxy; + +use Appwrite\Platform\Modules\Proxy\Services\Http; +use Utopia\Platform; + +class Module extends Platform\Module +{ + public function __construct() + { + $this->addService('http', new Http()); + } +} diff --git a/src/Appwrite/Platform/Modules/Proxy/Services/Http.php b/src/Appwrite/Platform/Modules/Proxy/Services/Http.php new file mode 100644 index 0000000000..c5f11ad5be --- /dev/null +++ b/src/Appwrite/Platform/Modules/Proxy/Services/Http.php @@ -0,0 +1,23 @@ +<?php + +namespace Appwrite\Platform\Modules\Proxy\Services; + +use Appwrite\Platform\Modules\Proxy\Http\Rules\API\Create as CreateAPIRule; +use Appwrite\Platform\Modules\Proxy\Http\Rules\Function\Create as CreateFunctionRule; +use Appwrite\Platform\Modules\Proxy\Http\Rules\Redirect\Create as CreateRedirectRule; +use Appwrite\Platform\Modules\Proxy\Http\Rules\Site\Create as CreateSiteRule; +use Utopia\Platform\Service; + +class Http extends Service +{ + public function __construct() + { + $this->type = Service::TYPE_HTTP; + + // Rules + $this->addAction(CreateAPIRule::getName(), new CreateAPIRule()); + $this->addAction(CreateSiteRule::getName(), new CreateSiteRule()); + $this->addAction(CreateFunctionRule::getName(), new CreateFunctionRule()); + $this->addAction(CreateRedirectRule::getName(), new CreateRedirectRule()); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php new file mode 100644 index 0000000000..7400d86e74 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Create.php @@ -0,0 +1,363 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Deployments; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\MethodType; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Storage\Device; +use Utopia\Storage\Validator\File; +use Utopia\Storage\Validator\FileExt; +use Utopia\Storage\Validator\FileSize; +use Utopia\Storage\Validator\Upload; +use Utopia\Swoole\Request; +use Utopia\System\System; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; + +class Create extends Action +{ + use HTTP; + + public static function getName() + { + return 'createDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/sites/:siteId/deployments') + ->desc('Create deployment') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('event', 'sites.[siteId].deployments.[deploymentId].create') + ->label('audits.event', 'deployment.create') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'deployments', + name: 'createDeployment', + description: <<<EOT + Create a new site code deployment. Use this endpoint to upload a new version of your site code. To activate your newly uploaded code, you'll need to update the function's deployment to use your new deployment ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_ACCEPTED, + model: Response::MODEL_DEPLOYMENT, + ) + ], + requestType: ContentType::MULTIPART, + type: MethodType::UPLOAD, + packaging: true, + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('installCommand', null, new Text(8192, 0), 'Install Commands.', true) + ->param('buildCommand', null, new Text(8192, 0), 'Build Commands.', true) + ->param('outputDirectory', null, new Text(8192, 0), 'Output Directory.', true) + ->param('code', [], new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', skipValidation: true) + ->param('activate', false, new Boolean(true), 'Automatically activate the deployment when it is finished building.') + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('project') + ->inject('queueForEvents') + ->inject('deviceForSites') + ->inject('deviceForLocal') + ->inject('queueForBuilds') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + ?string $installCommand, + ?string $buildCommand, + ?string $outputDirectory, + mixed $code, + mixed $activate, + Request $request, + Response $response, + Database $dbForProject, + Database $dbForPlatform, + Document $project, + Event $queueForEvents, + Device $deviceForSites, + Device $deviceForLocal, + Build $queueForBuilds + ) { + $activate = \strval($activate) === 'true' || \strval($activate) === '1'; + + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + if ($installCommand === null) { + $installCommand = $site->getAttribute('installCommand', ''); + } + + if ($buildCommand === null) { + $buildCommand = $site->getAttribute('buildCommand', ''); + } + + if ($outputDirectory === null) { + $outputDirectory = $site->getAttribute('outputDirectory', ''); + } + + $file = $request->getFiles('code'); + + // GraphQL multipart spec adds files with index keys + if (empty($file)) { + $file = $request->getFiles(0); + } + + if (empty($file)) { + throw new Exception(Exception::STORAGE_FILE_EMPTY, 'No file sent'); + } + + $fileExt = new FileExt([FileExt::TYPE_GZIP]); + $fileSizeValidator = new FileSize(System::getEnv('_APP_COMPUTE_SIZE_LIMIT', '30000000')); + $upload = new Upload(); + + // Make sure we handle a single file and multiple files the same way + $fileName = (\is_array($file['name']) && isset($file['name'][0])) ? $file['name'][0] : $file['name']; + $fileTmpName = (\is_array($file['tmp_name']) && isset($file['tmp_name'][0])) ? $file['tmp_name'][0] : $file['tmp_name']; + $fileSize = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size']; + + if (!$fileExt->isValid($file['name'])) { // Check if file type is allowed + throw new Exception(Exception::STORAGE_FILE_TYPE_UNSUPPORTED); + } + + $contentRange = $request->getHeader('content-range'); + $deploymentId = ID::unique(); + $chunk = 1; + $chunks = 1; + + if (!empty($contentRange)) { + $start = $request->getContentRangeStart(); + $end = $request->getContentRangeEnd(); + $fileSize = $request->getContentRangeSize(); + $deploymentId = $request->getHeader('x-appwrite-id', $deploymentId); + // TODO make `end >= $fileSize` in next breaking version + if (is_null($start) || is_null($end) || is_null($fileSize) || $end > $fileSize) { + throw new Exception(Exception::STORAGE_INVALID_CONTENT_RANGE); + } + + // TODO remove the condition that checks `$end === $fileSize` in next breaking version + if ($end === $fileSize - 1 || $end === $fileSize) { + //if it's a last chunks the chunk size might differ, so we set the $chunks and $chunk to notify it's last chunk + $chunks = $chunk = -1; + } else { + // Calculate total number of chunks based on the chunk size i.e ($rangeEnd - $rangeStart) + $chunks = (int) ceil($fileSize / ($end + 1 - $start)); + $chunk = (int) ($start / ($end + 1 - $start)) + 1; + } + } + + if (!$fileSizeValidator->isValid($fileSize)) { // Check if file size is exceeding allowed limit + throw new Exception(Exception::STORAGE_INVALID_FILE_SIZE); + } + + if (!$upload->isValid($fileTmpName)) { + throw new Exception(Exception::STORAGE_INVALID_FILE); + } + + // Save to storage + $fileSize ??= $deviceForLocal->getFileSize($fileTmpName); + $path = $deviceForSites->getPath($deploymentId . '.' . \pathinfo($fileName, PATHINFO_EXTENSION)); + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + $metadata = ['content_type' => $deviceForLocal->getFileMimeType($fileTmpName)]; + if (!$deployment->isEmpty()) { + $chunks = $deployment->getAttribute('sourceChunksTotal', 1); + $metadata = $deployment->getAttribute('sourceMetadata', []); + if ($chunk === -1) { + $chunk = $chunks; + } + } + + $chunksUploaded = $deviceForSites->upload($fileTmpName, $path, $chunk, $chunks, $metadata); + + if (empty($chunksUploaded)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed moving file'); + } + + $type = $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual'; + + $commands = []; + if (!empty($installCommand)) { + $commands[] = $installCommand; + } + if (!empty($buildCommand)) { + $commands[] = $buildCommand; + } + + if ($chunksUploaded === $chunks) { + if ($activate) { + // Remove deploy for all other deployments. + $activeDeployments = $dbForProject->find('deployments', [ + Query::equal('activate', [true]), + Query::equal('resourceId', [$siteId]), + Query::equal('resourceType', ['sites']) + ]); + + foreach ($activeDeployments as $activeDeployment) { + $activeDeployment->setAttribute('activate', false); + $dbForProject->updateDocument('deployments', $activeDeployment->getId(), $activeDeployment); + } + } + + $fileSize = $deviceForSites->getFileSize($path); + + if ($deployment->isEmpty()) { + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceInternalId' => $site->getInternalId(), + 'resourceId' => $site->getId(), + 'resourceType' => 'sites', + 'buildCommands' => \implode(' && ', $commands), + 'buildOutput' => $outputDirectory, + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), + 'sourcePath' => $path, + 'sourceSize' => $fileSize, + 'totalSize' => $fileSize, + 'activate' => $activate, + 'sourceMetadata' => $metadata, + 'type' => $type, + ])); + + $site = $site + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('sites', $site->getId(), $site); + + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + $domain = ID::unique() . "." . $sitesDomain; + + // TODO: @christyjacob remove once we migrate the rules in 1.7.x + $ruleId = System::getEnv('_APP_RULES_FORMAT') === 'md5' ? md5($domain) : ID::unique(); + + Authorization::skip( + fn () => $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain, + 'type' => 'deployment', + 'trigger' => 'deployment', + 'deploymentId' => $deployment->isEmpty() ? '' : $deployment->getId(), + 'deploymentInternalId' => $deployment->isEmpty() ? '' : $deployment->getInternalId(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $site->getId(), + 'deploymentResourceInternalId' => $site->getInternalId(), + 'status' => 'verified', + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain]), + 'owner' => 'Appwrite', + 'region' => $project->getAttribute('region') + ])) + ); + } else { + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment->setAttribute('sourceSize', $fileSize)->setAttribute('sourceMetadata', $metadata)); + } + + // Start the build + $queueForBuilds + ->setType(BUILD_TYPE_DEPLOYMENT) + ->setResource($site) + ->setDeployment($deployment); + } else { + if ($deployment->isEmpty()) { + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceInternalId' => $site->getInternalId(), + 'resourceId' => $site->getId(), + 'resourceType' => 'sites', + 'buildCommands' => \implode(' && ', $commands), + 'buildOutput' => $outputDirectory, + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), + 'sourcePath' => $path, + 'sourceSize' => $fileSize, + 'totalSize' => $fileSize, + 'sourceChunksTotal' => $chunks, + 'sourceChunksUploaded' => $chunksUploaded, + 'activate' => $activate, + 'sourceMetadata' => $metadata, + 'type' => $type, + ])); + + $site = $site + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('sites', $site->getId(), $site); + + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + $domain = ID::unique() . "." . $sitesDomain; + $ruleId = md5($domain); + Authorization::skip( + fn () => $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain, + 'type' => 'deployment', + 'trigger' => 'deployment', + 'value' => $deployment->getId(), + 'status' => 'verified', + 'certificateId' => '', + 'search' => implode(' ', [$ruleId, $domain]), + ])) + ); + } else { + $deployment = $dbForProject->updateDocument('deployments', $deploymentId, $deployment->setAttribute('sourceChunksUploaded', $chunksUploaded)->setAttribute('sourceMetadata', $metadata)); + } + } + + $metadata = null; + + $queueForEvents + ->setParam('siteId', $site->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php new file mode 100644 index 0000000000..27db10c484 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Delete.php @@ -0,0 +1,138 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Deployments; + +use Appwrite\Event\Delete as DeleteEvent; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Query; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Storage\Device; + +class Delete extends Action +{ + use HTTP; + + public static function getName() + { + return 'deleteDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/sites/:siteId/deployments/:deploymentId') + ->desc('Delete deployment') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('event', 'sites.[siteId].deployments.[deploymentId].delete') + ->label('audits.event', 'deployment.delete') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'deployments', + name: 'deleteDeployment', + description: <<<EOT + Delete a site deployment by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForDeletes') + ->inject('queueForEvents') + ->inject('deviceForSites') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $deploymentId, + Response $response, + Database $dbForProject, + DeleteEvent $queueForDeletes, + Event $queueForEvents, + Device $deviceForSites + ) { + $site = $dbForProject->getDocument('sites', $siteId); + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if ($deployment->getAttribute('resourceId') !== $site->getId()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if (!$dbForProject->deleteDocument('deployments', $deployment->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from DB'); + } + + if (!empty($deployment->getAttribute('sourcePath', ''))) { + if (!($deviceForSites->delete($deployment->getAttribute('sourcePath', '')))) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove deployment from storage'); + } + } + + if ($site->getAttribute('latestDeploymentId') === $deployment->getId()) { + $latestDeployment = $dbForProject->findOne('deployments', [ + Query::equal('resourceType', ['sites']), + Query::equal('resourceInternalId', [$site->getInternalId()]), + Query::orderDesc('$createdAt'), + ]); + $site = $dbForProject->updateDocument( + 'sites', + $site->getId(), + $site + ->setAttribute('latestDeploymentCreatedAt', $latestDeployment->isEmpty() ? '' : $latestDeployment->getCreatedAt()) + ->setAttribute('latestDeploymentInternalId', $latestDeployment->isEmpty() ? '' : $latestDeployment->getInternalId()) + ->setAttribute('latestDeploymentId', $latestDeployment->isEmpty() ? '' : $latestDeployment->getId()) + ->setAttribute('latestDeploymentStatus', $latestDeployment->isEmpty() ? '' : $latestDeployment->getAttribute('status', '')) + ); + } + + if ($site->getAttribute('deploymentId') === $deployment->getId()) { // Reset site deployment + $site = $dbForProject->updateDocument('sites', $site->getId(), new Document(array_merge($site->getArrayCopy(), [ + 'deploymentId' => '', + 'deploymentInternalId' => '', + 'deploymentScreenshotDark' => '', + 'deploymentScreenshotLight' => '', + 'deploymentCreatedAt' => '', + ]))); + } + + $queueForEvents + ->setParam('siteId', $site->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $queueForDeletes + ->setType(DELETE_TYPE_DOCUMENT) + ->setDocument($deployment); + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php new file mode 100644 index 0000000000..e83af0bab6 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Download/Get.php @@ -0,0 +1,151 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Download; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\MethodType; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Storage\Device; +use Utopia\Swoole\Request; +use Utopia\Validator\WhiteList; + +class Get extends Action +{ + use HTTP; + + public static function getName() + { + return 'getDeploymentDownload'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/:siteId/deployments/:deploymentId/download') + ->desc('Get deployment download') + ->groups(['api', 'sites']) + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'deployments', + name: 'getDeploymentDownload', + description: <<<EOT + Get a site deployment content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. + EOT, + auth: [AuthType::KEY, AuthType::JWT], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_NONE + ) + ], + type: MethodType::LOCATION, + contentType: ContentType::ANY, + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->param('type', 'source', new WhiteList(['source', 'output']), 'Deployment file to download. Can be: "source", "output".', true) + ->inject('response') + ->inject('request') + ->inject('dbForProject') + ->inject('deviceForSites') + ->inject('deviceForBuilds') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $deploymentId, + string $type, + Response $response, + Request $request, + Database $dbForProject, + Device $deviceForSites, + Device $deviceForBuilds + ) { + $site = $dbForProject->getDocument('sites', $siteId); + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if ($deployment->getAttribute('resourceId') !== $site->getId()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + switch ($type) { + case 'output': + $path = $deployment->getAttribute('buildPath', ''); + $device = $deviceForBuilds; + break; + case 'source': + $path = $deployment->getAttribute('sourcePath', ''); + $device = $deviceForSites; + break; + } + + if (!$device->exists($path)) { + throw new Exception(Exception::BUILD_NOT_FOUND); + } + + $response + ->setContentType('application/gzip') + ->addHeader('Expires', \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)) . ' GMT') // 45 days cache + ->addHeader('X-Peak', \memory_get_peak_usage()) + ->addHeader('Content-Disposition', 'attachment; filename="' . $deploymentId . '-' . $type . '.tar.gz"'); + + $size = $device->getFileSize($path); + $rangeHeader = $request->getHeader('range'); + + if (!empty($rangeHeader)) { + $start = $request->getRangeStart(); + $end = $request->getRangeEnd(); + $unit = $request->getRangeUnit(); + + if ($end === null) { + $end = min(($start + MAX_OUTPUT_CHUNK_SIZE - 1), ($size - 1)); + } + + if ($unit !== 'bytes' || $start >= $end || $end >= $size) { + throw new Exception(Exception::STORAGE_INVALID_RANGE); + } + + $response + ->addHeader('Accept-Ranges', 'bytes') + ->addHeader('Content-Range', 'bytes ' . $start . '-' . $end . '/' . $size) + ->addHeader('Content-Length', $end - $start + 1) + ->setStatusCode(Response::STATUS_CODE_PARTIALCONTENT); + + $response->send($device->read($path, $start, ($end - $start + 1))); + } + + if ($size > APP_STORAGE_READ_BUFFER) { + for ($i = 0; $i < ceil($size / MAX_OUTPUT_CHUNK_SIZE); $i++) { + $response->chunk( + $device->read( + $path, + ($i * MAX_OUTPUT_CHUNK_SIZE), + min(MAX_OUTPUT_CHUNK_SIZE, $size - ($i * MAX_OUTPUT_CHUNK_SIZE)) + ), + (($i + 1) * MAX_OUTPUT_CHUNK_SIZE) >= $size + ); + } + } else { + $response->send($device->read($path)); + } + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php new file mode 100644 index 0000000000..bff0735328 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Duplicate/Create.php @@ -0,0 +1,182 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Duplicate; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Storage\Device; +use Utopia\Swoole\Request; +use Utopia\System\System; + +class Create extends Action +{ + use HTTP; + + public static function getName() + { + return 'createDuplicateDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/sites/:siteId/deployments/duplicate') + ->desc('Create duplicate deployment') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('event', 'sites.[siteId].deployments.[deploymentId].update') + ->label('audits.event', 'deployment.update') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'deployments', + name: 'createDuplicateDeployment', + description: <<<EOT + Create a new build for an existing site deployment. This endpoint allows you to rebuild a deployment with the updated site configuration, including its commands and output directory if they have been modified. The build process will be queued and executed asynchronously. The original deployment's code will be preserved and used for the new build. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_ACCEPTED, + model: Response::MODEL_DEPLOYMENT, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->inject('request') + ->inject('response') + ->inject('project') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('queueForEvents') + ->inject('queueForBuilds') + ->inject('deviceForSites') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $deploymentId, + Request $request, + Response $response, + Document $project, + Database $dbForProject, + Database $dbForPlatform, + Event $queueForEvents, + Build $queueForBuilds, + Device $deviceForSites + ) { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + $path = $deployment->getAttribute('sourcePath'); + if (empty($path) || !$deviceForSites->exists($path)) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + $deploymentId = ID::unique(); + + $destination = $deviceForSites->getPath($deploymentId . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION)); + $deviceForSites->transfer($path, $destination, $deviceForSites); + + $commands = []; + + if (!empty($site->getAttribute('installCommand', ''))) { + $commands[] = $site->getAttribute('installCommand', ''); + } + if (!empty($site->getAttribute('buildCommand', ''))) { + $commands[] = $site->getAttribute('buildCommand', ''); + } + + $deployment->removeAttribute('$internalId'); + $deployment = $dbForProject->createDocument('deployments', $deployment->setAttributes([ + '$internalId' => '', + '$id' => $deploymentId, + 'sourcePath' => $destination, + 'totalSize' => $deployment->getAttribute('sourceSize', 0), + 'buildCommands' => \implode(' && ', $commands), + 'buildOutput' => $site->getAttribute('outputDirectory', ''), + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), + 'screenshotLight' => '', + 'screenshotDark' => '', + 'buildStartedAt' => null, + 'buildEndedAt' => null, + 'buildDuration' => 0, + 'buildSize' => 0, + 'status' => 'waiting', + 'buildPath' => '', + 'buildLogs' => '', + 'type' => $request->getHeader('x-sdk-language') === 'cli' ? 'cli' : 'manual' + ])); + + $site = $site + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('sites', $site->getId(), $site); + + // Preview deployments for sites + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + $domain = ID::unique() . "." . $sitesDomain; + + // TODO: @christyjacob remove once we migrate the rules in 1.7.x + $ruleId = System::getEnv('_APP_RULES_FORMAT') === 'md5' ? md5($domain) : ID::unique(); + + Authorization::skip( + fn () => $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain, + 'type' => 'deployment', + 'trigger' => 'deployment', + 'deploymentId' => $deployment->isEmpty() ? '' : $deployment->getId(), + 'deploymentInternalId' => $deployment->isEmpty() ? '' : $deployment->getInternalId(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $site->getId(), + 'deploymentResourceInternalId' => $site->getInternalId(), + 'status' => 'verified', + 'certificateId' => '', + 'owner' => 'Appwrite', + 'region' => $project->getAttribute('region') + ])) + ); + + $queueForBuilds + ->setType(BUILD_TYPE_DEPLOYMENT) + ->setResource($site) + ->setDeployment($deployment); + + $queueForEvents + ->setParam('siteId', $site->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php new file mode 100644 index 0000000000..d280231159 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Get.php @@ -0,0 +1,75 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Deployments; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Action +{ + use HTTP; + + public static function getName() + { + return 'getDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/:siteId/deployments/:deploymentId') + ->desc('Get deployment') + ->groups(['api', 'sites']) + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'deployments', + name: 'getDeployment', + description: <<<EOT + Get a site deployment by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_DEPLOYMENT, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $siteId, string $deploymentId, Response $response, Database $dbForProject) + { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if ($deployment->getAttribute('resourceId') !== $site->getId()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + $response->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php new file mode 100644 index 0000000000..2c6da43893 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Status/Update.php @@ -0,0 +1,118 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Status; + +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Executor\Executor; +use Utopia\Database\Database; +use Utopia\Database\DateTime; +use Utopia\Database\Document; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Update extends Action +{ + use HTTP; + + public static function getName() + { + return 'updateDeploymentStatus'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpPath('/v1/sites/:siteId/deployments/:deploymentId/status') + ->desc('Update deployment status') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('audits.event', 'deployment.update') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'deployments', + name: 'updateDeploymentStatus', + description: <<<EOT + Cancel an ongoing site deployment build. If the build is already in progress, it will be stopped and marked as canceled. If the build hasn't started yet, it will be marked as canceled without executing. You cannot cancel builds that have already completed (status 'ready') or failed. The response includes the final build status and details. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_DEPLOYMENT, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('project') + ->inject('queueForEvents') + ->inject('executor') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $deploymentId, + Response $response, + Database $dbForProject, + Document $project, + Event $queueForEvents, + Executor $executor + ) { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if (\in_array($deployment->getAttribute('status'), ['ready', 'failed'])) { + throw new Exception(Exception::BUILD_ALREADY_COMPLETED); + } + + $startTime = new \DateTime($deployment->getAttribute('buildStartedAt', 'now')); + $endTime = new \DateTime('now'); + $duration = $endTime->getTimestamp() - $startTime->getTimestamp(); + + $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment->setAttributes([ + 'buildEndedAt' => DateTime::now(), + 'buildDuration' => $duration, + 'status' => 'canceled' + ])); + + if ($deployment->getInternalId() === $site->getAttribute('latestDeploymentInternalId', '')) { + $site = $site->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('sites', $site->getId(), $site); + } + + try { + $executor->deleteRuntime($project->getId(), $deploymentId . "-build"); + } catch (\Throwable $th) { + // Don't throw if the deployment doesn't exist + if ($th->getCode() !== 404) { + throw $th; + } + } + + $queueForEvents + ->setParam('siteId', $site->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php new file mode 100644 index 0000000000..5b29521ce5 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Template/Create.php @@ -0,0 +1,213 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Template; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Swoole\Request; +use Utopia\System\System; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; +use Utopia\VCS\Adapter\Git\GitHub; + +class Create extends Base +{ + use HTTP; + + public static function getName() + { + return 'createTemplateDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/sites/:siteId/deployments/template') + ->desc('Create template deployment') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('event', 'sites.[siteId].deployments.[deploymentId].create') + ->label('audits.event', 'deployment.create') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'deployments', + name: 'createTemplateDeployment', + description: <<<EOT + Create a deployment based on a template. + + Use this endpoint with combination of [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to find the template details. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_ACCEPTED, + model: Response::MODEL_DEPLOYMENT, + ) + ], + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('repository', '', new Text(128, 0), 'Repository name of the template.') + ->param('owner', '', new Text(128, 0), 'The name of the owner of the template.') + ->param('rootDirectory', '', new Text(128, 0), 'Path to site code in the template repo.') + ->param('version', '', new Text(128, 0), 'Version (tag) for the repo linked to the site template.') + ->param('activate', false, new Boolean(), 'Automatically activate the deployment when it is finished building.', true) + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('project') + ->inject('queueForEvents') + ->inject('queueForBuilds') + ->inject('gitHub') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $repository, + string $owner, + string $rootDirectory, + string $version, + bool $activate, + Request $request, + Response $response, + Database $dbForProject, + Database $dbForPlatform, + Document $project, + Event $queueForEvents, + Build $queueForBuilds, + GitHub $github + ) { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $template = new Document([ + 'repositoryName' => $repository, + 'ownerName' => $owner, + 'rootDirectory' => $rootDirectory, + 'version' => $version + ]); + + if (!empty($site->getAttribute('providerRepositoryId'))) { + $installation = $dbForPlatform->getDocument('installations', $site->getAttribute('installationId')); + + $deployment = $this->redeployVcsSite( + request: $request, + site: $site, + project: $project, + installation: $installation, + dbForProject: $dbForProject, + dbForPlatform: $dbForPlatform, + queueForBuilds: $queueForBuilds, + template: $template, + github: $github, + activate: $activate, + ); + + $queueForEvents + ->setParam('siteId', $site->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + + return; + } + + $commands = []; + if (!empty($site->getAttribute('installCommand', ''))) { + $commands[] = $site->getAttribute('installCommand', ''); + } + if (!empty($site->getAttribute('buildCommand', ''))) { + $commands[] = $site->getAttribute('buildCommand', ''); + } + + $deploymentId = ID::unique(); + $deployment = $dbForProject->createDocument('deployments', new Document([ + '$id' => $deploymentId, + '$permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + 'resourceId' => $site->getId(), + 'resourceInternalId' => $site->getInternalId(), + 'resourceType' => 'sites', + 'buildCommands' => \implode(' && ', $commands), + 'buildOutput' => $site->getAttribute('outputDirectory', ''), + 'adapter' => $site->getAttribute('adapter', ''), + 'fallbackFile' => $site->getAttribute('fallbackFile', ''), + 'type' => 'manual', + 'activate' => $activate, + ])); + + $site = $site + ->setAttribute('latestDeploymentId', $deployment->getId()) + ->setAttribute('latestDeploymentInternalId', $deployment->getInternalId()) + ->setAttribute('latestDeploymentCreatedAt', $deployment->getCreatedAt()) + ->setAttribute('latestDeploymentStatus', $deployment->getAttribute('status', '')); + $dbForProject->updateDocument('sites', $site->getId(), $site); + + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + $domain = ID::unique() . "." . $sitesDomain; + + // TODO: @christyjacob remove once we migrate the rules in 1.7.x + $ruleId = System::getEnv('_APP_RULES_FORMAT') === 'md5' ? md5($domain) : ID::unique(); + + Authorization::skip( + fn () => $dbForPlatform->createDocument('rules', new Document([ + '$id' => $ruleId, + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'domain' => $domain, + 'type' => 'deployment', + 'trigger' => 'deployment', + 'deploymentId' => $deployment->isEmpty() ? '' : $deployment->getId(), + 'deploymentInternalId' => $deployment->isEmpty() ? '' : $deployment->getInternalId(), + 'deploymentResourceType' => 'site', + 'deploymentResourceId' => $site->getId(), + 'deploymentResourceInternalId' => $site->getInternalId(), + 'status' => 'verified', + 'certificateId' => '', + 'owner' => 'Appwrite', + 'region' => $project->getAttribute('region') + ])) + ); + + $queueForBuilds + ->setType(BUILD_TYPE_DEPLOYMENT) + ->setResource($site) + ->setDeployment($deployment) + ->setTemplate($template); + + $queueForEvents + ->setParam('siteId', $site->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php new file mode 100644 index 0000000000..eb6fdf4094 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/Vcs/Create.php @@ -0,0 +1,125 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Deployments\Vcs; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Swoole\Request; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; +use Utopia\Validator\WhiteList; +use Utopia\VCS\Adapter\Git\GitHub; + +class Create extends Base +{ + use HTTP; + + public static function getName() + { + return 'createVcsDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/sites/:siteId/deployments/vcs') + ->desc('Create VCS deployment') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('event', 'sites.[siteId].deployments.[deploymentId].create') + ->label('audits.event', 'deployment.create') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'deployments', + name: 'createVcsDeployment', + description: <<<EOT + Create a deployment when a site is connected to VCS. + + This endpoint lets you create deployment from a branch, commit, or a tag. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_ACCEPTED, + model: Response::MODEL_DEPLOYMENT, + ) + ], + )) + ->param('siteId', '', new UID(), 'Site ID.') + // TODO: Support tag in future + ->param('type', '', new WhiteList(['branch', 'commit', 'tag']), 'Type of reference passed. Allowed values are: branch, commit') + ->param('reference', '', new Text(255), 'VCS reference to create deployment from. Depending on type this can be: branch name, commit hash') + ->param('activate', false, new Boolean(), 'Automatically activate the deployment when it is finished building.', true) + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('dbForPlatform') + ->inject('project') + ->inject('queueForEvents') + ->inject('queueForBuilds') + ->inject('gitHub') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $type, + string $reference, + bool $activate, + Request $request, + Response $response, + Database $dbForProject, + Database $dbForPlatform, + Document $project, + Event $queueForEvents, + Build $queueForBuilds, + GitHub $github + ) { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $template = new Document(); + + $installation = $dbForPlatform->getDocument('installations', $site->getAttribute('installationId')); + + $deployment = $this->redeployVcsSite( + request: $request, + site: $site, + project: $project, + installation: $installation, + dbForProject: $dbForProject, + dbForPlatform: $dbForPlatform, + queueForBuilds: $queueForBuilds, + template: $template, + github: $github, + activate: $activate, + reference: $reference, + referenceType: $type + ); + + $queueForEvents + ->setParam('siteId', $site->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_ACCEPTED) + ->dynamic($deployment, Response::MODEL_DEPLOYMENT); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php new file mode 100644 index 0000000000..d7cfc1d3ad --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Deployments/XList.php @@ -0,0 +1,124 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Deployments; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\Queries\Deployments; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Order as OrderException; +use Utopia\Database\Exception\Query as QueryException; +use Utopia\Database\Query; +use Utopia\Database\Validator\Query\Cursor; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Text; + +class XList extends Action +{ + use HTTP; + + public static function getName() + { + return 'listDeployments'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/:siteId/deployments') + ->desc('List deployments') + ->groups(['api', 'sites']) + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'deployments', + name: 'listDeployments', + description: <<<EOT + Get a list of all the site's code deployments. You can use the query params to filter your results. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_DEPLOYMENT_LIST, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('queries', [], new Deployments(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Deployments::ALLOWED_ATTRIBUTES), true) + ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $siteId, array $queries, string $search, Response $response, Database $dbForProject) + { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + if (!empty($search)) { + $queries[] = Query::search('search', $search); + } + + // Set resource queries + $queries[] = Query::equal('resourceInternalId', [$site->getInternalId()]); + $queries[] = Query::equal('resourceType', ['sites']); + + /** + * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries + */ + $cursor = \array_filter($queries, function ($query) { + return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); + }); + $cursor = reset($cursor); + if ($cursor) { + /** @var Query $cursor */ + + $validator = new Cursor(); + if (!$validator->isValid($cursor)) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); + } + + $deploymentId = $cursor->getValue(); + $cursorDocument = $dbForProject->getDocument('deployments', $deploymentId); + + if ($cursorDocument->isEmpty()) { + throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Deployment '{$deploymentId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + + try { + $results = $dbForProject->find('deployments', $queries); + $total = $dbForProject->count('deployments', $filterQueries, APP_LIMIT_COUNT); + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } + + $response->dynamic(new Document([ + 'deployments' => $results, + 'total' => $total, + ]), Response::MODEL_DEPLOYMENT_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php new file mode 100644 index 0000000000..cf2bb8c62b --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php @@ -0,0 +1,67 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Frameworks; + +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Document; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listFrameworks'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/frameworks') + ->desc('List frameworks') + ->groups(['api']) + ->label('scope', 'public') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'frameworks', + name: 'listFrameworks', + description: <<<EOT + Get a list of all frameworks that are currently available on the server instance. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_FRAMEWORK_LIST, + ) + ] + )) + ->inject('response') + ->callback([$this, 'action']); + } + + public function action(Response $response) + { + $frameworks = Config::getParam('frameworks'); + + foreach ($frameworks as $key => $framework) { + if (!empty($framework['adapters'])) { + $frameworks[$key]['adapters'] = \array_values($framework['adapters']); + } + } + + $response->dynamic(new Document([ + 'total' => count($frameworks), + 'frameworks' => \array_values($frameworks) + ]), Response::MODEL_FRAMEWORK_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php new file mode 100644 index 0000000000..a411cee91f --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Delete.php @@ -0,0 +1,89 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Logs; + +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Delete extends Base +{ + use HTTP; + + public static function getName() + { + return 'deleteLog'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/sites/:siteId/logs/:logId') + ->desc('Delete log') + ->groups(['api', 'sites']) + ->label('scope', 'log.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('event', 'sites.[siteId].logs.[logId].delete') + ->label('audits.event', 'logs.delete') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'logs', + name: 'deleteLog', + description: <<<EOT + Delete a site log by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('logId', '', new UID(), 'Log ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->callback([$this, 'action']); + } + + public function action(string $siteId, string $logId, Response $response, Database $dbForProject, Event $queueForEvents) + { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $log = $dbForProject->getDocument('executions', $logId); + if ($log->isEmpty()) { + throw new Exception(Exception::LOG_NOT_FOUND); + } + + if ($log->getAttribute('resourceType') !== 'sites' && $log->getAttribute('resourceInternalId') !== $site->getInternalId()) { + throw new Exception(Exception::LOG_NOT_FOUND); + } + + if (!$dbForProject->deleteDocument('executions', $log->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove log from DB'); + } + + $queueForEvents + ->setParam('siteId', $site->getId()) + ->setParam('logId', $log->getId()) + ->setPayload($response->output($log, Response::MODEL_EXECUTION)); // TODO: Update model + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php new file mode 100644 index 0000000000..3d1ace2d20 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/Get.php @@ -0,0 +1,76 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Logs; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getLog'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/:siteId/logs/:logId') + ->desc('Get log') + ->groups(['api', 'sites']) + ->label('scope', 'log.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'logs', + name: 'getLog', + description: <<<EOT + Get a site request log by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_EXECUTION, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('logId', '', new UID(), 'Log ID.') + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $siteId, string $logId, Response $response, Database $dbForProject) + { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty() || !$site->getAttribute('enabled')) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $log = $dbForProject->getDocument('executions', $logId); + + if ($log->getAttribute('resourceType') !== 'sites' && $log->getAttribute('resourceInternalId') !== $site->getInternalId()) { + throw new Exception(Exception::LOG_NOT_FOUND); + } + + if ($log->isEmpty()) { + throw new Exception(Exception::LOG_NOT_FOUND); + } + + $response->dynamic($log, Response::MODEL_EXECUTION); //TODO: Change to model log, but model log already exists - decide what to do + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php new file mode 100644 index 0000000000..a873d32603 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Logs/XList.php @@ -0,0 +1,120 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Logs; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\Queries\Executions; +use Appwrite\Utopia\Database\Validator\Queries\Logs; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Order as OrderException; +use Utopia\Database\Exception\Query as QueryException; +use Utopia\Database\Query; +use Utopia\Database\Validator\Query\Cursor; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listLogs'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/:siteId/logs') + ->desc('List logs') + ->groups(['api', 'sites']) + ->label('scope', 'log.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'logs', + name: 'listLogs', + description: <<<EOT + Get a list of all site logs. You can use the query params to filter your results. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_EXECUTION_LIST, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('queries', [], new Logs(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Executions::ALLOWED_ATTRIBUTES), true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $siteId, array $queries, Response $response, Database $dbForProject) + { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty() || !$site->getAttribute('enabled')) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + // Set internal queries + $queries[] = Query::equal('resourceInternalId', [$site->getInternalId()]); + $queries[] = Query::equal('resourceType', ['sites']); + + /** + * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries + */ + $cursor = \array_filter($queries, function ($query) { + return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); + }); + $cursor = reset($cursor); + if ($cursor) { + /** @var Query $cursor */ + + $validator = new Cursor(); + if (!$validator->isValid($cursor)) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); + } + + $logId = $cursor->getValue(); + $cursorDocument = $dbForProject->getDocument('executions', $logId); + + if ($cursorDocument->isEmpty() || $cursorDocument->getAttribute('resourceType') !== 'sites') { + throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Log '{$logId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + + try { + $results = $dbForProject->find('executions', $queries); + $total = $dbForProject->count('executions', $filterQueries, APP_LIMIT_COUNT); + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } + + $response->dynamic(new Document([ + 'executions' => $results, + 'total' => $total, + ]), Response::MODEL_EXECUTION_LIST); // TODO: Update response model + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php new file mode 100644 index 0000000000..c509799024 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Create.php @@ -0,0 +1,205 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Sites; + +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Validator\Specification; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\CustomId; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\System\System; +use Utopia\Validator\Boolean; +use Utopia\Validator\Range; +use Utopia\Validator\Text; +use Utopia\Validator\WhiteList; + +class Create extends Base +{ + use HTTP; + + public static function getName() + { + return 'createSite'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/sites') + ->desc('Create site') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('event', 'sites.[siteId].create') + ->label('audits.event', 'site.create') + ->label('audits.resource', 'site/{response.$id}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'sites', + name: 'create', + description: <<<EOT + Create a new site. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_SITE, + ) + ], + )) + ->param('siteId', '', new CustomId(), 'Site ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.') + ->param('name', '', new Text(128), 'Site name. Max length: 128 chars.') + ->param('framework', '', new WhiteList(\array_keys(Config::getParam('frameworks')), true), 'Sites framework.') + ->param('enabled', true, new Boolean(), 'Is site enabled? When set to \'disabled\', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.', true) + ->param('logging', true, new Boolean(), 'When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.', true) + ->param('timeout', 30, new Range(1, (int) System::getEnv('_APP_SITES_TIMEOUT', 30)), 'Maximum request time in seconds.', true) + ->param('installCommand', '', new Text(8192, 0), 'Install Command.', true) + ->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true) + ->param('outputDirectory', '', new Text(8192, 0), 'Output Directory for site.', true) + ->param('buildRuntime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Runtime to use during build step.') + ->param('adapter', '', new WhiteList(['static', 'ssr']), 'Framework adapter defining rendering strategy. Allowed values are: static, ssr', true) + ->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for VCS (Version Control System) deployment.', true) + ->param('fallbackFile', '', new Text(255, 0), 'Fallback file for single page application sites.', true) + ->param('providerRepositoryId', '', new Text(128, 0), 'Repository ID of the repo linked to the site.', true) + ->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the site.', true) + ->param('providerSilentMode', false, new Boolean(), 'Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.', true) + ->param('providerRootDirectory', '', new Text(128, 0), 'Path to site code in the linked repo.', true) + ->param('specification', APP_COMPUTE_SPECIFICATION_DEFAULT, fn (array $plan) => new Specification( + $plan, + Config::getParam('specifications', []), + System::getEnv('_APP_COMPUTE_CPUS', 0), + System::getEnv('_APP_COMPUTE_MEMORY', 0) + ), 'Framework specification for the site and builds.', true, ['plan']) + ->inject('response') + ->inject('dbForProject') + ->inject('project') + ->inject('queueForEvents') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $name, + string $framework, + bool $enabled, + bool $logging, + int $timeout, + string $installCommand, + string $buildCommand, + string $outputDirectory, + string $buildRuntime, + string $adapter, + string $installationId, + string $fallbackFile, + string $providerRepositoryId, + string $providerBranch, + bool $providerSilentMode, + string $providerRootDirectory, + string $specification, + Response $response, + Database $dbForProject, + Document $project, + Event $queueForEvents, + Database $dbForPlatform + ) { + if (!empty($adapter)) { + $configFramework = Config::getParam('frameworks')[$framework] ?? []; + $adapters = \array_keys($configFramework['adapters'] ?? []); + $validator = new WhiteList($adapters, true); + if (!$validator->isValid($adapter)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Adapter not supported for the selected framework.'); + } + } + + $siteId = ($siteId == 'unique()') ? ID::unique() : $siteId; + + $installation = $dbForPlatform->getDocument('installations', $installationId); + + if (!empty($installationId) && $installation->isEmpty()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + + if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); + } + + $site = $dbForProject->createDocument('sites', new Document([ + '$id' => $siteId, + 'enabled' => $enabled, + 'live' => true, + 'logging' => $logging, + 'name' => $name, + 'framework' => $framework, + 'deploymentInternalId' => '', + 'deploymentId' => '', + 'timeout' => $timeout, + 'installCommand' => $installCommand, + 'buildCommand' => $buildCommand, + 'outputDirectory' => $outputDirectory, + 'search' => implode(' ', [$siteId, $name, $framework]), + 'fallbackFile' => $fallbackFile, + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'repositoryId' => '', + 'repositoryInternalId' => '', + 'providerBranch' => $providerBranch, + 'providerRootDirectory' => $providerRootDirectory, + 'providerSilentMode' => $providerSilentMode, + 'specification' => $specification, + 'buildRuntime' => $buildRuntime, + 'adapter' => $adapter, + ])); + + // Git connect logic + if (!empty($providerRepositoryId)) { + $teamId = $project->getAttribute('teamId', ''); + + $repository = $dbForPlatform->createDocument('repositories', new Document([ + '$id' => ID::unique(), + '$permissions' => [ + Permission::read(Role::team(ID::custom($teamId))), + Permission::update(Role::team(ID::custom($teamId), 'owner')), + Permission::update(Role::team(ID::custom($teamId), 'developer')), + Permission::delete(Role::team(ID::custom($teamId), 'owner')), + Permission::delete(Role::team(ID::custom($teamId), 'developer')), + ], + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'resourceId' => $site->getId(), + 'resourceInternalId' => $site->getInternalId(), + 'resourceType' => 'site', + 'providerPullRequestIds' => [] + ])); + + $site->setAttribute('repositoryId', $repository->getId()); + $site->setAttribute('repositoryInternalId', $repository->getInternalId()); + } + + $site = $dbForProject->updateDocument('sites', $site->getId(), $site); + + $queueForEvents->setParam('siteId', $site->getId()); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($site, Response::MODEL_SITE); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php new file mode 100644 index 0000000000..37666215e5 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Delete.php @@ -0,0 +1,89 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Sites; + +use Appwrite\Event\Delete as DeleteEvent; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Delete extends Base +{ + use HTTP; + + public static function getName() + { + return 'deleteSite'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/sites/:siteId') + ->desc('Delete site') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('event', 'sites.[siteId].delete') + ->label('audits.event', 'site.delete') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'sites', + name: 'delete', + description: <<<EOT + Delete a site by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForDeletes') + ->inject('queueForEvents') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + Response $response, + Database $dbForProject, + DeleteEvent $queueForDeletes, + Event $queueForEvents + ) { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + if (!$dbForProject->deleteDocument('sites', $site->getId())) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'Failed to remove site from DB'); + } + + $queueForDeletes + ->setType(DELETE_TYPE_DOCUMENT) + ->setDocument($site); + + $queueForEvents->setParam('siteId', $site->getId()); + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php new file mode 100644 index 0000000000..7f1681c0f1 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Deployment/Update.php @@ -0,0 +1,125 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Sites\Deployment; + +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Query; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Update extends Base +{ + use HTTP; + + public static function getName() + { + return 'updateSiteDeployment'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpPath('/v1/sites/:siteId/deployment') + ->desc('Update site\'s deployment') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('event', 'sites.[siteId].deployments.[deploymentId].update') + ->label('audits.event', 'deployment.update') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'sites', + name: 'updateSiteDeployment', + description: <<<EOT + Update the site active deployment. Use this endpoint to switch the code deployment that should be used when visitor opens your site. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_SITE, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('deploymentId', '', new UID(), 'Deployment ID.') + ->inject('project') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->inject('dbForPlatform') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $deploymentId, + Document $project, + Response $response, + Database $dbForProject, + Event $queueForEvents, + Database $dbForPlatform + ) { + $site = $dbForProject->getDocument('sites', $siteId); + $deployment = $dbForProject->getDocument('deployments', $deploymentId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + if ($deployment->isEmpty()) { + throw new Exception(Exception::DEPLOYMENT_NOT_FOUND); + } + + if ($deployment->getAttribute('status') !== 'ready') { + throw new Exception(Exception::BUILD_NOT_READY); + } + + $oldDeploymentInternalId = $site->getAttribute('deploymentInternalId', ''); + + $site = $dbForProject->updateDocument('sites', $site->getId(), new Document(array_merge($site->getArrayCopy(), [ + 'deploymentInternalId' => $deployment->getInternalId(), + 'deploymentId' => $deployment->getId(), + 'deploymentScreenshotDark' => $deployment->getAttribute('screenshotDark', ''), + 'deploymentScreenshotLight' => $deployment->getAttribute('screenshotLight', ''), + 'deploymentCreatedAt' => $deployment->getCreatedAt(), + ]))); + + $queries = [ + Query::equal('trigger', 'manual'), + Query::equal("type", ["deployment"]), + Query::equal("deploymentResourceType", ["site"]), + Query::equal("deploymentResourceInternalId", [$site->getInternalId()]), + ]; + + if (empty($oldDeploymentInternalId)) { + $queries[] = Query::equal("deploymentInternalId", [""]); + } else { + $queries[] = Query::equal("deploymentInternalId", [$oldDeploymentInternalId]); + } + + $this->listRules($project, $queries, $dbForPlatform, function (Document $rule) use ($dbForPlatform, $deployment) { + $rule = $rule + ->setAttribute('deploymentId', $deployment->getId()) + ->setAttribute('deploymentInternalId', $deployment->getInternalId()); + $dbForPlatform->updateDocument('rules', $rule->getId(), $rule); + }); + + $queueForEvents + ->setParam('siteId', $site->getId()) + ->setParam('deploymentId', $deployment->getId()); + + $response->dynamic($site, Response::MODEL_SITE); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php new file mode 100644 index 0000000000..88ff5f1d51 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Get.php @@ -0,0 +1,65 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Sites; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getSite'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/:siteId') + ->desc('Get site') + ->groups(['api', 'sites']) + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'sites', + name: 'get', + description: <<<EOT + Get a site by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_SITE, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $siteId, Response $response, Database $dbForProject) + { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $response->dynamic($site, Response::MODEL_SITE); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php new file mode 100644 index 0000000000..212b410178 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/Update.php @@ -0,0 +1,282 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Sites; + +use Appwrite\Event\Build; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\Platform\Modules\Compute\Validator\Specification; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Executor\Executor; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Query; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Swoole\Request; +use Utopia\System\System; +use Utopia\Validator\Boolean; +use Utopia\Validator\Range; +use Utopia\Validator\Text; +use Utopia\Validator\WhiteList; +use Utopia\VCS\Adapter\Git\GitHub; + +class Update extends Base +{ + use HTTP; + + public static function getName() + { + return 'updateSite'; + } + + public function __construct() + { + $this->setHttpMethod(Action::HTTP_REQUEST_METHOD_PUT) + ->setHttpPath('/v1/sites/:siteId') + ->desc('Update site') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('event', 'sites.[siteId].update') + ->label('audits.event', 'sites.update') + ->label('audits.resource', 'site/{response.$id}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'sites', + name: 'update', + description: <<<EOT + Update site by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_SITE, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('name', '', new Text(128), 'Site name. Max length: 128 chars.') + ->param('framework', '', new WhiteList(\array_keys(Config::getParam('frameworks')), true), 'Sites framework.') + ->param('enabled', true, new Boolean(), 'Is site enabled? When set to \'disabled\', users cannot access the site but Server SDKs with and API key can still access the site. No data is lost when this is toggled.', true) + ->param('logging', true, new Boolean(), 'When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.', true) + ->param('timeout', 30, new Range(1, (int) System::getEnv('_APP_SITES_TIMEOUT', 30)), 'Maximum request time in seconds.', true) + ->param('installCommand', '', new Text(8192, 0), 'Install Command.', true) + ->param('buildCommand', '', new Text(8192, 0), 'Build Command.', true) + ->param('outputDirectory', '', new Text(8192, 0), 'Output Directory for site.', true) + ->param('buildRuntime', '', new WhiteList(array_keys(Config::getParam('runtimes')), true), 'Runtime to use during build step.', true) + ->param('adapter', '', new WhiteList(['static', 'ssr']), 'Framework adapter defining rendering strategy. Allowed values are: static, ssr', true) + ->param('fallbackFile', '', new Text(255, 0), 'Fallback file for single page application sites.', true) + ->param('installationId', '', new Text(128, 0), 'Appwrite Installation ID for VCS (Version Control System) deployment.', true) + ->param('providerRepositoryId', '', new Text(128, 0), 'Repository ID of the repo linked to the site.', true) + ->param('providerBranch', '', new Text(128, 0), 'Production branch for the repo linked to the site.', true) + ->param('providerSilentMode', false, new Boolean(), 'Is the VCS (Version Control System) connection in silent mode for the repo linked to the site? In silent mode, comments will not be made on commits and pull requests.', true) + ->param('providerRootDirectory', '', new Text(128, 0), 'Path to site code in the linked repo.', true) + ->param('specification', APP_COMPUTE_SPECIFICATION_DEFAULT, fn (array $plan) => new Specification( + $plan, + Config::getParam('specifications', []), + System::getEnv('_APP_COMPUTE_CPUS', 0), + System::getEnv('_APP_COMPUTE_MEMORY', 0) + ), 'Framework specification for the site and builds.', true, ['plan']) + ->inject('request') + ->inject('response') + ->inject('dbForProject') + ->inject('project') + ->inject('queueForEvents') + ->inject('queueForBuilds') + ->inject('dbForPlatform') + ->inject('gitHub') + ->inject('executor') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $name, + string $framework, + bool $enabled, + bool $logging, + int $timeout, + string $installCommand, + string $buildCommand, + string $outputDirectory, + string $buildRuntime, + string $adapter, + string $fallbackFile, + string $installationId, + ?string $providerRepositoryId, + string $providerBranch, + bool $providerSilentMode, + string $providerRootDirectory, + string $specification, + Request $request, + Response $response, + Database $dbForProject, + Document $project, + Event $queueForEvents, + Build $queueForBuilds, + Database $dbForPlatform, + GitHub $github, + Executor $executor + ) { + if (!empty($adapter)) { + $configFramework = Config::getParam('frameworks')[$framework] ?? []; + $adapters = \array_keys($configFramework['adapters'] ?? []); + $validator = new WhiteList($adapters, true); + if (!$validator->isValid($adapter)) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'Adapter not supported for the selected framework.'); + } + } + + // TODO: If only branch changes, re-deploy + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $installation = $dbForPlatform->getDocument('installations', $installationId); + + if (!empty($installationId) && $installation->isEmpty()) { + throw new Exception(Exception::INSTALLATION_NOT_FOUND); + } + + if (!empty($providerRepositoryId) && (empty($installationId) || empty($providerBranch))) { + throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'When connecting to VCS (Version Control System), you need to provide "installationId" and "providerBranch".'); + } + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + if (empty($framework)) { + $framework = $site->getAttribute('framework'); + } + + $enabled ??= $site->getAttribute('enabled', true); + + $repositoryId = $site->getAttribute('repositoryId', ''); + $repositoryInternalId = $site->getAttribute('repositoryInternalId', ''); + + $isConnected = !empty($site->getAttribute('providerRepositoryId', '')); + + // Git disconnect logic. Disconnecting only when providerRepositoryId is empty, allowing for continue updates without disconnecting git + if ($isConnected && ($providerRepositoryId !== null && empty($providerRepositoryId))) { + $repositories = $dbForPlatform->find('repositories', [ + Query::equal('projectInternalId', [$project->getInternalId()]), + Query::equal('resourceInternalId', [$site->getInternalId()]), + Query::equal('resourceType', ['site']), + Query::limit(100), + ]); + + foreach ($repositories as $repository) { + $dbForPlatform->deleteDocument('repositories', $repository->getId()); + } + + $providerRepositoryId = ''; + $installationId = ''; + $providerBranch = ''; + $providerRootDirectory = ''; + $providerSilentMode = true; + $repositoryId = ''; + $repositoryInternalId = ''; + } + + // Git connect logic + if (!$isConnected && !empty($providerRepositoryId)) { + $teamId = $project->getAttribute('teamId', ''); + + $repository = $dbForPlatform->createDocument('repositories', new Document([ + '$id' => ID::unique(), + '$permissions' => [ + Permission::read(Role::team(ID::custom($teamId))), + Permission::update(Role::team(ID::custom($teamId), 'owner')), + Permission::update(Role::team(ID::custom($teamId), 'developer')), + Permission::delete(Role::team(ID::custom($teamId), 'owner')), + Permission::delete(Role::team(ID::custom($teamId), 'developer')), + ], + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'projectId' => $project->getId(), + 'projectInternalId' => $project->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'resourceId' => $site->getId(), + 'resourceInternalId' => $site->getInternalId(), + 'resourceType' => 'site', + 'providerPullRequestIds' => [] + ])); + + $repositoryId = $repository->getId(); + $repositoryInternalId = $repository->getInternalId(); + } + + $live = true; + + if ( + $site->getAttribute('name') !== $name || + $site->getAttribute('buildCommand') !== $buildCommand || + $site->getAttribute('installCommand') !== $installCommand || + $site->getAttribute('outputDirectory') !== $outputDirectory || + $site->getAttribute('providerRootDirectory') !== $providerRootDirectory || + $site->getAttribute('framework') !== $framework + ) { + $live = false; + } + + // Enforce Cold Start if spec limits change. + if ($site->getAttribute('specification') !== $specification && !empty($site->getAttribute('deploymentId'))) { + try { + $executor->deleteRuntime($project->getId(), $site->getAttribute('deploymentId')); + } catch (\Throwable $th) { + // Don't throw if the deployment doesn't exist + if ($th->getCode() !== 404) { + throw $th; + } + } + } + + $site = $dbForProject->updateDocument('sites', $site->getId(), new Document(array_merge($site->getArrayCopy(), [ + 'name' => $name, + 'framework' => $framework, + 'enabled' => $enabled, + 'logging' => $logging, + 'live' => $live, + 'timeout' => $timeout, + 'installCommand' => $installCommand, + 'buildCommand' => $buildCommand, + 'outputDirectory' => $outputDirectory, + 'installationId' => $installation->getId(), + 'installationInternalId' => $installation->getInternalId(), + 'providerRepositoryId' => $providerRepositoryId, + 'repositoryId' => $repositoryId, + 'repositoryInternalId' => $repositoryInternalId, + 'providerBranch' => $providerBranch, + 'providerRootDirectory' => $providerRootDirectory, + 'providerSilentMode' => $providerSilentMode, + 'specification' => $specification, + 'search' => implode(' ', [$siteId, $name, $framework]), + 'buildRuntime' => $buildRuntime, + 'adapter' => $adapter, + 'fallbackFile' => $fallbackFile, + ]))); + + // Redeploy logic + if (!$isConnected && !empty($providerRepositoryId)) { + $this->redeployVcsFunction($request, $site, $project, $installation, $dbForProject, $queueForBuilds, new Document(), $github, true); + } + + $queueForEvents->setParam('siteId', $site->getId()); + + $response->dynamic($site, Response::MODEL_SITE); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php new file mode 100644 index 0000000000..0a3b257f59 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Sites/XList.php @@ -0,0 +1,113 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Sites; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\Queries\Sites; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Order as OrderException; +use Utopia\Database\Exception\Query as QueryException; +use Utopia\Database\Query; +use Utopia\Database\Validator\Query\Cursor; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Text; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listSites'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites') + ->desc('List sites') + ->groups(['api', 'sites']) + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'sites', + name: 'list', + description: <<<EOT + Get a list of all the project's sites. You can use the query params to filter your results. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_SITE_LIST, + ) + ] + )) + ->param('queries', [], new Sites(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', Sites::ALLOWED_ATTRIBUTES), true) + ->param('search', '', new Text(256), 'Search term to filter your list results. Max length: 256 chars.', true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(array $queries, string $search, Response $response, Database $dbForProject) + { + try { + $queries = Query::parseQueries($queries); + } catch (QueryException $e) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $e->getMessage()); + } + + if (!empty($search)) { + $queries[] = Query::search('search', $search); + } + + /** + * Get cursor document if there was a cursor query, we use array_filter and reset for reference $cursor to $queries + */ + $cursor = \array_filter($queries, function ($query) { + return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); + }); + $cursor = reset($cursor); + if ($cursor) { + /** @var Query $cursor */ + + $validator = new Cursor(); + if (!$validator->isValid($cursor)) { + throw new Exception(Exception::GENERAL_QUERY_INVALID, $validator->getDescription()); + } + + $siteId = $cursor->getValue(); + $cursorDocument = $dbForProject->getDocument('sites', $siteId); + + if ($cursorDocument->isEmpty()) { + throw new Exception(Exception::GENERAL_CURSOR_NOT_FOUND, "Site '{$siteId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + + try { + $sites = $dbForProject->find('sites', $queries); + $total = $dbForProject->count('sites', $filterQueries, APP_LIMIT_COUNT); + } catch (OrderException $e) { + throw new Exception(Exception::DATABASE_QUERY_ORDER_NULL, "The order attribute '{$e->getAttribute()}' had a null value. Cursor pagination requires all documents order attribute values are non-null."); + } + + $response->dynamic(new Document([ + 'sites' => $sites, + 'total' => $total, + ]), Response::MODEL_SITE_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php new file mode 100644 index 0000000000..2a9447f8c6 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Specifications/XList.php @@ -0,0 +1,81 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Specifications; + +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Document; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\System\System; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listSpecifications'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/specifications') + ->groups(['api', 'sites']) + ->desc('List specifications') + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'frameworks', + name: 'listSpecifications', + description: <<<EOT + List allowed site specifications for this instance. + EOT, + auth: [AuthType::KEY, AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_SPECIFICATION_LIST, + ) + ] + )) + ->inject('response') + ->inject('plan') + ->callback([$this, 'action']); + } + + public function action(Response $response, array $plan) + { + $allSpecs = Config::getParam('specifications', []); + + $specs = []; + foreach ($allSpecs as $spec) { + $spec['enabled'] = true; + + if (array_key_exists('runtimeSpecifications', $plan)) { + $spec['enabled'] = in_array($spec['slug'], $plan['runtimeSpecifications']); + } + + $maxCpus = System::getEnv('_APP_FUNCTIONS_CPUS', 0); + $maxMemory = System::getEnv('_APP_FUNCTIONS_MEMORY', 0); + + // Only add specs that are within the limits set by environment variables + // Treat 0 as no limit + if ((empty($maxCpus) || $spec['cpus'] <= $maxCpus) && (empty($maxMemory) || $spec['memory'] <= $maxMemory)) { + $specs[] = $spec; + } + } + + $response->dynamic(new Document([ + 'specifications' => $specs, + 'total' => count($specs) + ]), Response::MODEL_SPECIFICATION_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php new file mode 100644 index 0000000000..a4066fb787 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Templates/Get.php @@ -0,0 +1,70 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Templates; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Document; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Text; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getTemplate'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/templates/:templateId') + ->desc('Get site template') + ->groups(['api']) + ->label('scope', 'public') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'templates', + name: 'getTemplate', + description: <<<EOT + Get a site template using ID. You can use template details in [createSite](/docs/references/cloud/server-nodejs/sites#create) method. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_TEMPLATE_SITE, + ) + ] + )) + ->param('templateId', '', new Text(128), 'Template ID.') + ->inject('response') + ->callback([$this, 'action']); + } + + public function action(string $templateId, Response $response) + { + $templates = Config::getParam('templates-site', []); + + $allowedTemplates = \array_filter($templates, function ($item) use ($templateId) { + return $item['key'] === $templateId; + }); + $template = array_shift($allowedTemplates); + + if (empty($template)) { + throw new Exception(Exception::SITE_TEMPLATE_NOT_FOUND); + } + + $response->dynamic(new Document($template), Response::MODEL_TEMPLATE_SITE); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php new file mode 100644 index 0000000000..414ecc9987 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Templates/XList.php @@ -0,0 +1,91 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Templates; + +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Document; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\ArrayList; +use Utopia\Validator\Range; +use Utopia\Validator\WhiteList; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listTemplates'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/templates') + ->desc('List templates') + ->groups(['api']) + ->label('scope', 'public') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'templates', + name: 'listTemplates', + description: <<<EOT + List available site templates. You can use template details in [createSite](/docs/references/cloud/server-nodejs/sites#create) method. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_TEMPLATE_SITE_LIST, + ) + ] + )) + ->param('frameworks', [], new ArrayList(new WhiteList(\array_keys(Config::getParam('frameworks')), true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of frameworks allowed for filtering site templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' frameworks are allowed.', true) + ->param('useCases', [], new ArrayList(new WhiteList(['dev-tools', 'starter', 'databases', 'ai', 'messaging', 'utilities']), APP_LIMIT_ARRAY_PARAMS_SIZE), 'List of use cases allowed for filtering site templates. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' use cases are allowed.', true) + ->param('limit', 25, new Range(1, 5000), 'Limit the number of templates returned in the response. Default limit is 25, and maximum limit is 5000.', true) + ->param('offset', 0, new Range(0, 5000), 'Offset the list of returned templates. Maximum offset is 5000.', true) + ->inject('response') + ->callback([$this, 'action']); + } + + public function action( + array $frameworks, + array $usecases, + int $limit, + int $offset, + Response $response + ) { + $templates = Config::getParam('templates-site', []); + + if (!empty($frameworks)) { + $templates = \array_filter($templates, function ($template) use ($frameworks) { + return \count(\array_intersect($frameworks, \array_column($template['frameworks'], 'key'))) > 0; + }); + } + + if (!empty($usecases)) { + $templates = \array_filter($templates, function ($template) use ($usecases) { + return \count(\array_intersect($usecases, $template['useCases'])) > 0; + }); + } + + \usort($templates, function ($a, $b) { + return $b['score'] <=> $a['score']; + }); + + $total = \count($templates); + $templates = \array_slice($templates, $offset, $limit); + $response->dynamic(new Document([ + 'templates' => $templates, + 'total' => $total, + ]), Response::MODEL_TEMPLATE_SITE_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php new file mode 100644 index 0000000000..8bf19a9c28 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Usage/Get.php @@ -0,0 +1,173 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Usage; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\WhiteList; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getUsage'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/:siteId/usage') + ->desc('Get site usage') + ->groups(['api', 'sites', 'usage']) + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: null, + name: 'getUsage', + description: <<<EOT + Get usage metrics and statistics for a for a specific site. View statistics including total deployments, builds, executions, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_USAGE_SITE, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site ID.') + ->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $range, + Response $response, + Database $dbForProject + ) { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $periods = Config::getParam('usage', []); + $stats = $usage = []; + $days = $periods[$range]; + $metrics = [ + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS_STORAGE), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_STORAGE), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_COMPUTE), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_COMPUTE), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_MB_SECONDS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_MB_SECONDS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_SUCCESS), + str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_SITES, $site->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_FAILED), + str_replace(['{siteInternalId}'], [$site->getInternalId()], METRIC_SITES_ID_REQUESTS), + str_replace(['{siteInternalId}'], [$site->getInternalId()], METRIC_SITES_ID_INBOUND), + str_replace(['{siteInternalId}'], [$site->getInternalId()], METRIC_SITES_ID_OUTBOUND), + + ]; + + Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats) { + foreach ($metrics as $metric) { + $result = $dbForProject->findOne('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', ['inf']) + ]); + + $stats[$metric]['total'] = $result['value'] ?? 0; + $limit = $days['limit']; + $period = $days['period']; + $results = $dbForProject->find('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', [$period]), + Query::limit($limit), + Query::orderDesc('time'), + ]); + $stats[$metric]['data'] = []; + foreach ($results as $result) { + $stats[$metric]['data'][$result->getAttribute('time')] = [ + 'value' => $result->getAttribute('value'), + ]; + } + } + }); + + $format = match ($days['period']) { + '1h' => 'Y-m-d\TH:00:00.000P', + '1d' => 'Y-m-d\T00:00:00.000P', + }; + + foreach ($metrics as $metric) { + $usage[$metric]['total'] = $stats[$metric]['total']; + $usage[$metric]['data'] = []; + $leap = time() - ($days['limit'] * $days['factor']); + while ($leap < time()) { + $leap += $days['factor']; + $formatDate = date($format, $leap); + $usage[$metric]['data'][] = [ + 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, + 'date' => $formatDate, + ]; + } + } + + $buildsTimeTotal = $usage[$metrics[4]]['total'] ?? 0; + $buildsTotal = $usage[$metrics[2]]['total'] ?? 0; + $response->dynamic(new Document([ + 'range' => $range, + 'deploymentsTotal' => $usage[$metrics[0]]['total'], + 'deploymentsStorageTotal' => $usage[$metrics[1]]['total'], + 'buildsTotal' => $buildsTotal, + 'buildsStorageTotal' => $usage[$metrics[3]]['total'], + 'buildsTimeTotal' => $buildsTimeTotal, + 'buildsTimeAverage' => $buildsTotal === 0 ? 0 : (int) ($buildsTimeTotal / $buildsTotal), + 'executionsTotal' => $usage[$metrics[5]]['total'], + 'executionsTimeTotal' => $usage[$metrics[6]]['total'], + 'buildsMbSecondsTotal' => $usage[$metrics[7]]['total'], + 'executionsMbSecondsTotal' => $usage[$metrics[8]]['total'], + 'buildsSuccessTotal' => $usage[$metrics[9]]['total'], + 'buildsFailedTotal' => $usage[$metrics[10]]['total'], + 'requestsTotal' => $usage[$metrics[11]]['total'], + 'inboundTotal' => $usage[$metrics[12]]['total'], + 'outboundTotal' => $usage[$metrics[13]]['total'], + 'deployments' => $usage[$metrics[0]]['data'], + 'deploymentsStorage' => $usage[$metrics[1]]['data'], + 'builds' => $usage[$metrics[2]]['data'], + 'buildsStorage' => $usage[$metrics[3]]['data'], + 'buildsTime' => $usage[$metrics[4]]['data'], + 'executions' => $usage[$metrics[5]]['data'], + 'executionsTime' => $usage[$metrics[6]]['data'], + 'buildsMbSeconds' => $usage[$metrics[7]]['data'], + 'executionsMbSeconds' => $usage[$metrics[8]]['data'], + 'buildsSuccess' => $usage[$metrics[9]]['data'], + 'buildsFailed' => $usage[$metrics[10]]['data'], + 'requests' => $usage[$metrics[11]]['data'], + 'inbound' => $usage[$metrics[12]]['data'], + 'outbound' => $usage[$metrics[13]]['data'], + ]), Response::MODEL_USAGE_SITE); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php new file mode 100644 index 0000000000..e37d3e792e --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Usage/XList.php @@ -0,0 +1,158 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Usage; + +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Config\Config; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\WhiteList; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'getSitesUsage'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/usage') + ->desc('Get sites usage') + ->groups(['api', 'sites', 'usage']) + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: null, + name: 'listUsage', + description: <<<EOT + Get usage metrics and statistics for all sites in the project. View statistics including total deployments, builds, logs, storage usage, and compute time. The response includes both current totals and historical data for each metric. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, defaults to 30 days. + EOT, + auth: [AuthType::ADMIN], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_USAGE_SITES, + ) + ] + )) + ->param('range', '30d', new WhiteList(['24h', '30d', '90d']), 'Date range.', true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $range, Response $response, Database $dbForProject) + { + $periods = Config::getParam('usage', []); + $stats = $usage = []; + $days = $periods[$range]; + $metrics = [ + METRIC_SITES, + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_DEPLOYMENTS), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_DEPLOYMENTS_STORAGE), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_BUILDS), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_BUILDS_STORAGE), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_BUILDS_COMPUTE), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_EXECUTIONS), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_EXECUTIONS_COMPUTE), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_BUILDS_MB_SECONDS), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_EXECUTIONS_MB_SECONDS), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_BUILDS_SUCCESS), + str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_BUILDS_FAILED), + METRIC_SITES_REQUESTS, + METRIC_SITES_INBOUND, + METRIC_SITES_OUTBOUND, + ]; + + Authorization::skip(function () use ($dbForProject, $days, $metrics, &$stats) { + foreach ($metrics as $metric) { + $result = $dbForProject->findOne('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', ['inf']) + ]); + + $stats[$metric]['total'] = $result['value'] ?? 0; + $limit = $days['limit']; + $period = $days['period']; + $results = $dbForProject->find('stats', [ + Query::equal('metric', [$metric]), + Query::equal('period', [$period]), + Query::limit($limit), + Query::orderDesc('time'), + ]); + $stats[$metric]['data'] = []; + foreach ($results as $result) { + $stats[$metric]['data'][$result->getAttribute('time')] = [ + 'value' => $result->getAttribute('value'), + ]; + } + } + }); + + $format = match ($days['period']) { + '1h' => 'Y-m-d\TH:00:00.000P', + '1d' => 'Y-m-d\T00:00:00.000P', + }; + + foreach ($metrics as $metric) { + $usage[$metric]['total'] = $stats[$metric]['total']; + $usage[$metric]['data'] = []; + $leap = time() - ($days['limit'] * $days['factor']); + while ($leap < time()) { + $leap += $days['factor']; + $formatDate = date($format, $leap); + $usage[$metric]['data'][] = [ + 'value' => $stats[$metric]['data'][$formatDate]['value'] ?? 0, + 'date' => $formatDate, + ]; + } + } + $response->dynamic(new Document([ + 'range' => $range, + 'sitesTotal' => $usage[$metrics[0]]['total'], + 'deploymentsTotal' => $usage[$metrics[1]]['total'], + 'deploymentsStorageTotal' => $usage[$metrics[2]]['total'], + 'buildsTotal' => $usage[$metrics[3]]['total'], + 'buildsStorageTotal' => $usage[$metrics[4]]['total'], + 'buildsTimeTotal' => $usage[$metrics[5]]['total'], + 'executionsTotal' => $usage[$metrics[6]]['total'], + 'executionsTimeTotal' => $usage[$metrics[7]]['total'], + 'buildsMbSecondsTotal' => $usage[$metrics[8]]['total'], + 'executionsMbSecondsTotal' => $usage[$metrics[9]]['total'], + 'buildsSuccessTotal' => $usage[$metrics[10]]['total'], + 'buildsFailedTotal' => $usage[$metrics[11]]['total'], + 'requestsTotal' => $usage[$metrics[12]]['total'], + 'inboundTotal' => $usage[$metrics[13]]['total'], + 'outboundTotal' => $usage[$metrics[14]]['total'], + 'sites' => $usage[$metrics[0]]['data'], + 'deployments' => $usage[$metrics[1]]['data'], + 'deploymentsStorage' => $usage[$metrics[2]]['data'], + 'builds' => $usage[$metrics[3]]['data'], + 'buildsStorage' => $usage[$metrics[4]]['data'], + 'buildsTime' => $usage[$metrics[5]]['data'], + 'executions' => $usage[$metrics[6]]['data'], + 'executionsTime' => $usage[$metrics[7]]['data'], + 'buildsMbSeconds' => $usage[$metrics[8]]['data'], + 'executionsMbSeconds' => $usage[$metrics[9]]['data'], + 'buildsSuccess' => $usage[$metrics[10]]['data'], + 'buildsFailed' => $usage[$metrics[11]]['data'], + 'requests' => $usage[$metrics[12]]['data'], + 'inbound' => $usage[$metrics[13]]['data'], + 'outbound' => $usage[$metrics[14]]['data'], + ]), Response::MODEL_USAGE_SITES); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php new file mode 100644 index 0000000000..ff1a5c50ec --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Create.php @@ -0,0 +1,109 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Exception\Duplicate as DuplicateException; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; + +class Create extends Base +{ + use HTTP; + + public static function getName() + { + return 'createVariable'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/sites/:siteId/variables') + ->desc('Create variable') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('audits.event', 'variable.create') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'variables', + name: 'createVariable', + description: <<<EOT + Create a new site variable. These variables can be accessed during build and runtime (server-side rendering) as environment variables. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_VARIABLE, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site unique ID.', false) + ->param('key', null, new Text(Database::LENGTH_KEY), 'Variable key. Max length: ' . Database::LENGTH_KEY . ' chars.', false) + ->param('value', null, new Text(8192, 0), 'Variable value. Max length: 8192 chars.', false) + ->param('secret', true, new Boolean(), 'Secret variables can be updated or deleted, but only sites can read them during build and runtime.', true) + ->inject('response') + ->inject('dbForProject') + ->inject('project') + ->callback([$this, 'action']); + } + + public function action(string $siteId, string $key, string $value, bool $secret, Response $response, Database $dbForProject, Document $project) + { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $variableId = ID::unique(); + + $teamId = $project->getAttribute('teamId', ''); + $variable = new Document([ + '$id' => $variableId, + '$permissions' => [ + Permission::read(Role::team(ID::custom($teamId))), + Permission::update(Role::team(ID::custom($teamId), 'owner')), + Permission::update(Role::team(ID::custom($teamId), 'developer')), + Permission::delete(Role::team(ID::custom($teamId), 'owner')), + Permission::delete(Role::team(ID::custom($teamId), 'developer')), + ], + 'resourceInternalId' => $site->getInternalId(), + 'resourceId' => $site->getId(), + 'resourceType' => 'site', + 'key' => $key, + 'value' => $value, + 'secret' => $secret, + 'search' => implode(' ', [$variableId, $site->getId(), $key, 'site']), + ]); + + try { + $variable = $dbForProject->createDocument('variables', $variable); + } catch (DuplicateException $th) { + throw new Exception(Exception::VARIABLE_ALREADY_EXISTS); + } + + $dbForProject->updateDocument('sites', $site->getId(), $site->setAttribute('live', false)); + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($variable, Response::MODEL_VARIABLE); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php new file mode 100644 index 0000000000..e4594a7c3d --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Delete.php @@ -0,0 +1,83 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Delete extends Base +{ + use HTTP; + + public static function getName() + { + return 'deleteVariable'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/sites/:siteId/variables/:variableId') + ->desc('Delete variable') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('audits.event', 'variable.delete') + ->label('audits.resource', 'site/{request.siteId}') + ->label('sdk', new Method( + namespace: 'sites', + group: 'variables', + name: 'deleteVariable', + description: <<<EOT + Delete a variable by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('siteId', '', new UID(), 'Site unique ID.', false) + ->param('variableId', '', new UID(), 'Variable unique ID.', false) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $siteId, string $variableId, Response $response, Database $dbForProject) + { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $variable = $dbForProject->getDocument('variables', $variableId); + if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceInternalId') !== $site->getInternalId() || $variable->getAttribute('resourceType') !== 'site') { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + if ($variable === false || $variable->isEmpty()) { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + $dbForProject->deleteDocument('variables', $variable->getId()); + + $dbForProject->updateDocument('sites', $site->getId(), $site->setAttribute('live', false)); + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php new file mode 100644 index 0000000000..a14129d432 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Get.php @@ -0,0 +1,83 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Base +{ + use HTTP; + + public static function getName() + { + return 'getVariable'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/:siteId/variables/:variableId') + ->desc('Get variable') + ->groups(['api', 'sites']) + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label( + 'sdk', + new Method( + namespace: 'sites', + group: 'variables', + name: 'getVariable', + description: <<<EOT + Get a variable by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_VARIABLE, + ) + ], + ) + ) + ->param('siteId', '', new UID(), 'Site unique ID.', false) + ->param('variableId', '', new UID(), 'Variable unique ID.', false) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $siteId, string $variableId, Response $response, Database $dbForProject) + { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $variable = $dbForProject->getDocument('variables', $variableId); + if ( + $variable === false || + $variable->isEmpty() || + $variable->getAttribute('resourceInternalId') !== $site->getInternalId() || + $variable->getAttribute('resourceType') !== 'site' + ) { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + if ($variable === false || $variable->isEmpty()) { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + $response->dynamic($variable, Response::MODEL_VARIABLE); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php new file mode 100644 index 0000000000..cd438a0ebb --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/Update.php @@ -0,0 +1,104 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Exception\Duplicate as DuplicateException; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Boolean; +use Utopia\Validator\Text; + +class Update extends Base +{ + use HTTP; + + public static function getName() + { + return 'updateVariable'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_PUT) + ->setHttpPath('/v1/sites/:siteId/variables/:variableId') + ->desc('Update variable') + ->groups(['api', 'sites']) + ->label('scope', 'sites.write') + ->label('audits.event', 'variable.update') + ->label('audits.resource', 'site/{request.siteId}') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label('sdk', new Method( + namespace: 'sites', + group: 'variables', + name: 'updateVariable', + description: <<<EOT + Update variable by its unique ID. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_VARIABLE, + ) + ] + )) + ->param('siteId', '', new UID(), 'Site unique ID.', false) + ->param('variableId', '', new UID(), 'Variable unique ID.', false) + ->param('key', null, new Text(255), 'Variable key. Max length: 255 chars.', false) + ->param('value', null, new Text(8192, 0), 'Variable value. Max length: 8192 chars.', true) + ->param('secret', null, new Boolean(), 'Secret variables can be updated or deleted, but only sites can read them during build and runtime.', true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + string $variableId, + string $key, + ?string $value, + ?bool $secret, + Response $response, + Database $dbForProject + ) { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $variable = $dbForProject->getDocument('variables', $variableId); + if ($variable === false || $variable->isEmpty() || $variable->getAttribute('resourceInternalId') !== $site->getInternalId() || $variable->getAttribute('resourceType') !== 'site') { + throw new Exception(Exception::VARIABLE_NOT_FOUND); + } + + if ($variable->getAttribute('secret') === true && $secret === false) { + throw new Exception(Exception::VARIABLE_CANNOT_UNSET_SECRET); + } + + $variable + ->setAttribute('key', $key) + ->setAttribute('value', $value ?? $variable->getAttribute('value')) + ->setAttribute('secret', $secret ?? $variable->getAttribute('secret')) + ->setAttribute('search', implode(' ', [$variableId, $site->getId(), $key, 'site'])); + + try { + $dbForProject->updateDocument('variables', $variable->getId(), $variable); + } catch (DuplicateException $th) { + throw new Exception(Exception::VARIABLE_ALREADY_EXISTS); + } + + $dbForProject->updateDocument('sites', $site->getId(), $site->setAttribute('live', false)); + + $response->dynamic($variable, Response::MODEL_VARIABLE); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php new file mode 100644 index 0000000000..15e21296a5 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Http/Variables/XList.php @@ -0,0 +1,75 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Http\Variables; + +use Appwrite\Extend\Exception; +use Appwrite\Platform\Modules\Compute\Base; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class XList extends Base +{ + use HTTP; + + public static function getName() + { + return 'listVariables'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/sites/:siteId/variables') + ->desc('List variables') + ->groups(['api', 'sites']) + ->label('scope', 'sites.read') + ->label('resourceType', RESOURCE_TYPE_SITES) + ->label( + 'sdk', + new Method( + namespace: 'sites', + group: 'variables', + name: 'listVariables', + description: <<<EOT + Get a list of all variables of a specific site. + EOT, + auth: [AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_VARIABLE_LIST, + ) + ], + ) + ) + ->param('siteId', '', new UID(), 'Site unique ID.', false) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action( + string $siteId, + Response $response, + Database $dbForProject + ) { + $site = $dbForProject->getDocument('sites', $siteId); + + if ($site->isEmpty()) { + throw new Exception(Exception::SITE_NOT_FOUND); + } + + $response->dynamic(new Document([ + 'variables' => $site->getAttribute('vars', []), + 'total' => \count($site->getAttribute('vars', [])), + ]), Response::MODEL_VARIABLE_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Module.php b/src/Appwrite/Platform/Modules/Sites/Module.php new file mode 100644 index 0000000000..86a6459a86 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Module.php @@ -0,0 +1,14 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites; + +use Appwrite\Platform\Modules\Sites\Services\Http; +use Utopia\Platform; + +class Module extends Platform\Module +{ + public function __construct() + { + $this->addService('http', new Http()); + } +} diff --git a/src/Appwrite/Platform/Modules/Sites/Services/Http.php b/src/Appwrite/Platform/Modules/Sites/Services/Http.php new file mode 100644 index 0000000000..6bd151f97e --- /dev/null +++ b/src/Appwrite/Platform/Modules/Sites/Services/Http.php @@ -0,0 +1,86 @@ +<?php + +namespace Appwrite\Platform\Modules\Sites\Services; + +use Appwrite\Platform\Modules\Sites\Http\Deployments\Create as CreateDeployment; +use Appwrite\Platform\Modules\Sites\Http\Deployments\Delete as DeleteDeployment; +use Appwrite\Platform\Modules\Sites\Http\Deployments\Download\Get as DownloadDeployment; +use Appwrite\Platform\Modules\Sites\Http\Deployments\Duplicate\Create as CreateDuplicateDeployment; +use Appwrite\Platform\Modules\Sites\Http\Deployments\Get as GetDeployment; +use Appwrite\Platform\Modules\Sites\Http\Deployments\Status\Update as UpdateDeploymentStatus; +use Appwrite\Platform\Modules\Sites\Http\Deployments\Template\Create as CreateTemplateDeployment; +use Appwrite\Platform\Modules\Sites\Http\Deployments\Vcs\Create as CreateVcsDeployment; +use Appwrite\Platform\Modules\Sites\Http\Deployments\XList as ListDeployments; +use Appwrite\Platform\Modules\Sites\Http\Frameworks\XList as ListFrameworks; +use Appwrite\Platform\Modules\Sites\Http\Logs\Delete as DeleteLog; +use Appwrite\Platform\Modules\Sites\Http\Logs\Get as GetLog; +use Appwrite\Platform\Modules\Sites\Http\Logs\XList as ListLogs; +use Appwrite\Platform\Modules\Sites\Http\Sites\Create as CreateSite; +use Appwrite\Platform\Modules\Sites\Http\Sites\Delete as DeleteSite; +use Appwrite\Platform\Modules\Sites\Http\Sites\Deployment\Update as UpdateSiteDeployment; +use Appwrite\Platform\Modules\Sites\Http\Sites\Get as GetSite; +use Appwrite\Platform\Modules\Sites\Http\Sites\Update as UpdateSite; +use Appwrite\Platform\Modules\Sites\Http\Sites\XList as ListSites; +use Appwrite\Platform\Modules\Sites\Http\Specifications\XList as ListSpecifications; +use Appwrite\Platform\Modules\Sites\Http\Templates\Get as GetTemplate; +use Appwrite\Platform\Modules\Sites\Http\Templates\XList as ListTemplates; +use Appwrite\Platform\Modules\Sites\Http\Usage\Get as GetUsage; +use Appwrite\Platform\Modules\Sites\Http\Usage\XList as ListUsage; +use Appwrite\Platform\Modules\Sites\Http\Variables\Create as CreateVariable; +use Appwrite\Platform\Modules\Sites\Http\Variables\Delete as DeleteVariable; +use Appwrite\Platform\Modules\Sites\Http\Variables\Get as GetVariable; +use Appwrite\Platform\Modules\Sites\Http\Variables\Update as UpdateVariable; +use Appwrite\Platform\Modules\Sites\Http\Variables\XList as ListVariables; +use Utopia\Platform\Service; + +class Http extends Service +{ + public function __construct() + { + $this->type = Service::TYPE_HTTP; + // Sites + $this->addAction(CreateSite::getName(), new CreateSite()); + $this->addAction(GetSite::getName(), new GetSite()); + $this->addAction(ListSites::getName(), new ListSites()); + $this->addAction(UpdateSite::getName(), new UpdateSite()); + $this->addAction(DeleteSite::getName(), new DeleteSite()); + + // Frameworks + $this->addAction(ListFrameworks::getName(), new ListFrameworks()); + + + // Deployments + $this->addAction(CreateDeployment::getName(), new CreateDeployment()); + $this->addAction(CreateTemplateDeployment::getName(), new CreateTemplateDeployment()); + $this->addAction(CreateVcsDeployment::getName(), new CreateVcsDeployment()); + $this->addAction(GetDeployment::getName(), new GetDeployment()); + $this->addAction(ListDeployments::getName(), new ListDeployments()); + $this->addAction(UpdateSiteDeployment::getName(), new UpdateSiteDeployment()); + $this->addAction(DeleteDeployment::getName(), new DeleteDeployment()); + $this->addAction(DownloadDeployment::getName(), new DownloadDeployment()); + $this->addAction(CreateDuplicateDeployment::getName(), new CreateDuplicateDeployment()); + $this->addAction(UpdateDeploymentStatus::getName(), new UpdateDeploymentStatus()); + + // Logs + $this->addAction(GetLog::getName(), new GetLog()); + $this->addAction(ListLogs::getName(), new ListLogs()); + $this->addAction(DeleteLog::getName(), new DeleteLog()); + + // Variables + $this->addAction(CreateVariable::getName(), new CreateVariable()); + $this->addAction(GetVariable::getName(), new GetVariable()); + $this->addAction(ListVariables::getName(), new ListVariables()); + $this->addAction(UpdateVariable::getName(), new UpdateVariable()); + $this->addAction(DeleteVariable::getName(), new DeleteVariable()); + + // Templates + $this->addAction(ListTemplates::getName(), new ListTemplates()); + $this->addAction(GetTemplate::getName(), new GetTemplate()); + + // Usage + $this->addAction(ListUsage::getName(), new ListUsage()); + $this->addAction(GetUsage::getName(), new GetUsage()); + + $this->addAction(ListSpecifications::getName(), new ListSpecifications()); + } +} diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Action.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Action.php new file mode 100644 index 0000000000..565ab7bab7 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Action.php @@ -0,0 +1,45 @@ +<?php + +namespace Appwrite\Platform\Modules\Tokens\Http\Tokens\Buckets\Files; + +use Appwrite\Auth\Auth; +use Appwrite\Extend\Exception; +use Utopia\Database\Database; +use Utopia\Database\Validator\Authorization; +use Utopia\Platform\Action as UtopiaAction; + +class Action extends UtopiaAction +{ + protected function getFileAndBucket(Database $dbForProject, string $bucketId, string $fileId): array + { + $bucket = Authorization::skip(fn () => $dbForProject->getDocument('buckets', $bucketId)); + + $isAPIKey = Auth::isAppUser(Authorization::getRoles()); + $isPrivilegedUser = Auth::isPrivilegedUser(Authorization::getRoles()); + + if ($bucket->isEmpty() || (!$bucket->getAttribute('enabled') && !$isAPIKey && !$isPrivilegedUser)) { + throw new Exception(Exception::STORAGE_BUCKET_NOT_FOUND); + } + + $validator = new Authorization(Database::PERMISSION_READ); + $valid = $validator->isValid($bucket->getRead()); + if (!$valid) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + + $fileSecurity = $bucket->getAttribute('fileSecurity', false); + if ($fileSecurity) { + $file = $dbForProject->getDocument('bucket_' . $bucket->getInternalId(), $fileId); + } else { + $file = Authorization::skip(fn () => $dbForProject->getDocument('bucket_' . $bucket->getInternalId(), $fileId)); + } + + if ($file->isEmpty()) { + throw new Exception(Exception::STORAGE_FILE_NOT_FOUND); + } + return [ + 'bucket' => $bucket, + 'file' => $file, + ]; + } +} diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php new file mode 100644 index 0000000000..4b3b421696 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/Create.php @@ -0,0 +1,113 @@ +<?php + +namespace Appwrite\Platform\Modules\Tokens\Http\Tokens\Buckets\Files; + +use Appwrite\Auth\Auth; +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Validator\Authorization; +use Utopia\Database\Validator\Datetime as DatetimeValidator; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Nullable; + +class Create extends Action +{ + use HTTP; + + public static function getName() + { + return 'createFileToken'; + } + + public function __construct() + { + $this->setHttpMethod(Action::HTTP_REQUEST_METHOD_POST) + ->setHttpPath('/v1/tokens/buckets/:bucketId/files/:fileId') + ->desc('Create file token') + ->groups(['api', 'token']) + ->label('scope', 'tokens.write') + ->label('event', 'tokens.[tokenId].create') + ->label('audits.event', 'token.create') + ->label('audits.resource', 'token/{response.$id}') + ->label('usage.metric', 'tokens.{scope}.requests.create') + ->label('usage.params', ['resourceId:{request.resourceId}', 'resourceType:{request.resourceType}']) + ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') + ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) + ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) + ->label('sdk', new Method( + namespace: 'tokens', + group: 'files', + name: 'createFileToken', + description: <<<EOT + Create a new token. A token is linked to a file. Token can be passed as a header or request get parameter. + EOT, + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_CREATED, + model: Response::MODEL_RESOURCE_TOKEN, + ) + ], + contentType: ContentType::JSON + )) + ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('fileId', '', new UID(), 'File unique ID.') + ->param('expire', null, new Nullable(new DatetimeValidator()), 'Token expiry date', true) + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->callback([$this, 'action']); + } + + public function action(string $bucketId, string $fileId, ?string $expire, Response $response, Database $dbForProject, Event $queueForEvents): void + { + + /** + * @var Document $bucket + * @var Document $file + */ + ['bucket' => $bucket, 'file' => $file] = $this->getFileAndBucket($dbForProject, $bucketId, $fileId); + + $fileSecurity = $bucket->getAttribute('fileSecurity', false); + $validator = new Authorization(Database::PERMISSION_UPDATE); + $bucketPermission = $validator->isValid($bucket->getUpdate()); + + if ($fileSecurity) { + $filePermission = $validator->isValid($file->getUpdate()); + if (!$bucketPermission && !$filePermission) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + } elseif (!$bucketPermission) { + throw new Exception(Exception::USER_UNAUTHORIZED); + } + + $token = $dbForProject->createDocument('resourceTokens', new Document([ + '$id' => ID::unique(), + 'secret' => Auth::tokenGenerator(128), + 'resourceId' => $bucketId . ':' . $fileId, + 'resourceInternalId' => $bucket->getInternalId() . ':' . $file->getInternalId(), + 'resourceType' => TOKENS_RESOURCE_TYPE_FILES, + 'expire' => $expire, + ])); + + $queueForEvents + ->setParam('bucketId', $bucket->getId()) + ->setParam('fileId', $file->getId()) + ->setParam('tokenId', $token->getId()) + ->setContext('bucket', $bucket) + ; + + $response + ->setStatusCode(Response::STATUS_CODE_CREATED) + ->dynamic($token, Response::MODEL_RESOURCE_TOKEN); + } +} diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php new file mode 100644 index 0000000000..38fe10e2d9 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Buckets/Files/XList.php @@ -0,0 +1,92 @@ +<?php + +namespace Appwrite\Platform\Modules\Tokens\Http\Tokens\Buckets\Files; + +use Appwrite\Extend\Exception as ExtendException; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Database\Validator\Queries\FileTokens; +use Appwrite\Utopia\Response; +use Exception; +use Utopia\Database\Database; +use Utopia\Database\Document; +use Utopia\Database\Query; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Scope\HTTP; + +class XList extends Action +{ + use HTTP; + + public static function getName() + { + return 'listFileTokens'; + } + + public function __construct() + { + $this + ->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/tokens/buckets/:bucketId/files/:fileId') + ->desc('List tokens') + ->groups(['api', 'tokens']) + ->label('scope', 'tokens.read') + ->label('usage.metric', 'tokens.requests.read') + ->label('sdk', new Method( + namespace: 'tokens', + group: 'files', + name: 'list', + description: <<<EOT + List all the tokens created for a specific file or bucket. You can use the query params to filter your results. + EOT, + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_RESOURCE_TOKEN_LIST, + ) + ], + contentType: ContentType::JSON + )) + ->param('bucketId', '', new UID(), 'Storage bucket unique ID. You can create a new storage bucket using the Storage service [server integration](https://appwrite.io/docs/server/storage#createBucket).') + ->param('fileId', '', new UID(), 'File unique ID.') + ->param('queries', [], new FileTokens(), 'Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' queries are allowed, each ' . APP_LIMIT_ARRAY_ELEMENT_SIZE . ' characters long. You may filter on the following attributes: ' . implode(', ', FileTokens::ALLOWED_ATTRIBUTES), true) + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $bucketId, string $fileId, array $queries, Response $response, Database $dbForProject) + { + ['bucket' => $bucket, 'file' => $file] = $this->getFileAndBucket($dbForProject, $bucketId, $fileId); + + $queries = Query::parseQueries($queries); + $queries[] = Query::equal('resourceType', [TOKENS_RESOURCE_TYPE_FILES]); + $queries[] = Query::equal('resourceInternalId', [$bucket->getInternalId() . ':' . $file->getInternalId()]); + // Get cursor document if there was a cursor query + $cursor = \array_filter($queries, function ($query) { + return \in_array($query->getMethod(), [Query::TYPE_CURSOR_AFTER, Query::TYPE_CURSOR_BEFORE]); + }); + $cursor = reset($cursor); + if ($cursor) { + /** @var Query $cursor */ + $tokenId = $cursor->getValue(); + $cursorDocument = $dbForProject->getDocument('resourceTokens', $tokenId); + + if ($cursorDocument->isEmpty()) { + throw new Exception(ExtendException::GENERAL_CURSOR_NOT_FOUND, "File token '{$tokenId}' for the 'cursor' value not found."); + } + + $cursor->setValue($cursorDocument); + } + + $filterQueries = Query::groupByType($queries)['filters']; + + $response->dynamic(new Document([ + 'tokens' => $dbForProject->find('resourceTokens', $queries), + 'total' => $dbForProject->count('resourceTokens', $filterQueries, APP_LIMIT_COUNT), + ]), Response::MODEL_RESOURCE_TOKEN_LIST); + } +} diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php new file mode 100644 index 0000000000..fcac9a6b24 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Delete.php @@ -0,0 +1,80 @@ +<?php + +namespace Appwrite\Platform\Modules\Tokens\Http\Tokens; + +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Delete extends Action +{ + use HTTP; + + public static function getName() + { + return 'deleteToken'; + } + + public function __construct() + { + $this->setHttpMethod(Action::HTTP_REQUEST_METHOD_DELETE) + ->setHttpPath('/v1/tokens/:tokenId') + ->desc('Delete token') + ->groups(['api', 'tokens']) + ->label('scope', 'tokens.write') + ->label('event', 'tokens.[tokenId].delete') + ->label('audits.event', 'tokens.delete') + ->label('audits.resource', 'token/{request.tokenId}') + ->label('usage.metric', 'tokens.{scope}.requests.delete') + ->label('usage.params', ['tokenId:{request.tokenId}']) + ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') + ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) + ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) + ->label('sdk', new Method( + namespace: 'tokens', + group: 'tokens', + name: 'delete', + description: <<<EOT + Delete a token by its unique ID. + EOT, + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_NOCONTENT, + model: Response::MODEL_NONE, + ) + ], + contentType: ContentType::NONE + )) + ->param('tokenId', '', new UID(), 'Token ID.') + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->callback([$this, 'action']); + } + + public function action(string $tokenId, Response $response, Database $dbForProject, Event $queueForEvents) + { + $token = $dbForProject->getDocument('resourceTokens', $tokenId); + if ($token->isEmpty()) { + throw new Exception(Exception::TOKEN_NOT_FOUND); + } + + $dbForProject->deleteDocument('resourceTokens', $tokenId); + + $queueForEvents + ->setParam('tokenId', $token->getId()) + ->setPayload($response->output($token, Response::MODEL_RESOURCE_TOKEN)) + ; + + $response->noContent(); + } +} diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php new file mode 100644 index 0000000000..66b9c1b5cb --- /dev/null +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Get.php @@ -0,0 +1,66 @@ +<?php + +namespace Appwrite\Platform\Modules\Tokens\Http\Tokens; + +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; + +class Get extends Action +{ + use HTTP; + + public static function getName() + { + return 'getToken'; + } + + public function __construct() + { + $this->setHttpMethod(Action::HTTP_REQUEST_METHOD_GET) + ->setHttpPath('/v1/tokens/:tokenId') + ->desc('Get token') + ->groups(['api', 'tokens']) + ->label('scope', 'tokens.read') + ->label('usage.metric', 'tokens.{scope}.requests.read') + ->label('usage.params', ['tokenId:{request.tokenId}']) + ->label('sdk', new Method( + namespace: 'tokens', + group: 'tokens', + name: 'get', + description: <<<EOT + Get a token by its unique ID. + EOT, + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_RESOURCE_TOKEN, + ) + ], + contentType: ContentType::JSON + )) + ->param('tokenId', '', new UID(), 'Token ID.') + ->inject('response') + ->inject('dbForProject') + ->callback([$this, 'action']); + } + + public function action(string $tokenId, Response $response, Database $dbForProject) + { + $token = $dbForProject->getDocument('resourceTokens', $tokenId); + + if ($token->isEmpty()) { + throw new Exception(Exception::TOKEN_NOT_FOUND); + } + + $response->dynamic($token, Response::MODEL_RESOURCE_TOKEN); + } +} diff --git a/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php new file mode 100644 index 0000000000..c341831c0d --- /dev/null +++ b/src/Appwrite/Platform/Modules/Tokens/Http/Tokens/Update.php @@ -0,0 +1,83 @@ +<?php + +namespace Appwrite\Platform\Modules\Tokens\Http\Tokens; + +use Appwrite\Event\Event; +use Appwrite\Extend\Exception; +use Appwrite\SDK\AuthType; +use Appwrite\SDK\ContentType; +use Appwrite\SDK\Method; +use Appwrite\SDK\Response as SDKResponse; +use Appwrite\Utopia\Response; +use Utopia\Database\Database; +use Utopia\Database\Validator\Datetime as DatetimeValidator; +use Utopia\Database\Validator\UID; +use Utopia\Platform\Action; +use Utopia\Platform\Scope\HTTP; +use Utopia\Validator\Nullable; + +class Update extends Action +{ + use HTTP; + + public static function getName() + { + return 'updateToken'; + } + + public function __construct() + { + $this->setHttpMethod(Action::HTTP_REQUEST_METHOD_PATCH) + ->setHttpPath('/v1/tokens/:tokenId') + ->desc('Update token') + ->groups(['api', 'tokens']) + ->label('scope', 'tokens.write') + ->label('event', 'tokens.[tokenId].update') + ->label('audits.event', 'tokens.update') + ->label('audits.resource', 'tokens/{response.$id}') + ->label('usage.metric', 'tokens.{scope}.requests.update') + ->label('usage.params', ['tokenId:{request.tokenId}']) + ->label('abuse-key', 'ip:{ip},method:{method},url:{url},userId:{userId}') + ->label('abuse-limit', APP_LIMIT_WRITE_RATE_DEFAULT) + ->label('abuse-time', APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT) + ->label('sdk', new Method( + namespace: 'tokens', + group: 'tokens', + name: 'update', + description: <<<EOT + Update a token by its unique ID. Use this endpoint to update a token's expiry date. + EOT, + auth: [AuthType::ADMIN, AuthType::KEY], + responses: [ + new SDKResponse( + code: Response::STATUS_CODE_OK, + model: Response::MODEL_RESOURCE_TOKEN, + ) + ], + contentType: ContentType::JSON + )) + ->param('tokenId', '', new UID(), 'Token unique ID.') + ->param('expire', null, new Nullable(new DatetimeValidator()), 'File token expiry date', true) + ->inject('response') + ->inject('dbForProject') + ->inject('queueForEvents') + ->callback([$this, 'action']); + } + + public function action(string $tokenId, ?string $expire, Response $response, Database $dbForProject, Event $queueForEvents) + { + $token = $dbForProject->getDocument('resourceTokens', $tokenId); + + if ($token->isEmpty()) { + throw new Exception(Exception::TOKEN_NOT_FOUND); + } + + $token->setAttribute('expire', $expire); + + $token = $dbForProject->updateDocument('resourceTokens', $tokenId, $token); + + $queueForEvents->setParam('tokenId', $token->getId()); + + $response->dynamic($token, Response::MODEL_RESOURCE_TOKEN); + } +} diff --git a/src/Appwrite/Platform/Modules/Tokens/Module.php b/src/Appwrite/Platform/Modules/Tokens/Module.php new file mode 100644 index 0000000000..9f49ef0111 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Tokens/Module.php @@ -0,0 +1,14 @@ +<?php + +namespace Appwrite\Platform\Modules\Tokens; + +use Appwrite\Platform\Modules\Tokens\Services\Http; +use Utopia\Platform; + +class Module extends Platform\Module +{ + public function __construct() + { + $this->addService('http', new Http()); + } +} diff --git a/src/Appwrite/Platform/Modules/Tokens/Services/Http.php b/src/Appwrite/Platform/Modules/Tokens/Services/Http.php new file mode 100644 index 0000000000..ac58c110a5 --- /dev/null +++ b/src/Appwrite/Platform/Modules/Tokens/Services/Http.php @@ -0,0 +1,26 @@ +<?php + +namespace Appwrite\Platform\Modules\Tokens\Services; + +use Appwrite\Platform\Modules\Tokens\Http\Tokens\Buckets\Files\Create as CreateFileToken; +use Appwrite\Platform\Modules\Tokens\Http\Tokens\Buckets\Files\XList as ListFileTokens; +use Appwrite\Platform\Modules\Tokens\Http\Tokens\Delete as DeleteToken; +use Appwrite\Platform\Modules\Tokens\Http\Tokens\Get as GetToken; +use Appwrite\Platform\Modules\Tokens\Http\Tokens\Update as UpdateToken; +use Utopia\Platform\Service; + +class Http extends Service +{ + public function __construct() + { + $this->type = Service::TYPE_HTTP; + $this + ->addAction(CreateFileToken::getName(), new CreateFileToken()) + ->addAction(GetToken::getName(), new GetToken()) + ->addAction(ListFileTokens::getName(), new ListFileTokens()) + ->addAction(UpdateToken::getName(), new UpdateToken()) + ->addAction(DeleteToken::getName(), new DeleteToken()) + ; + + } +} diff --git a/src/Appwrite/Platform/Services/Tasks.php b/src/Appwrite/Platform/Services/Tasks.php index 6a6cb3237a..3ada193cf7 100644 --- a/src/Appwrite/Platform/Services/Tasks.php +++ b/src/Appwrite/Platform/Services/Tasks.php @@ -10,6 +10,7 @@ use Appwrite\Platform\Tasks\QueueRetry; use Appwrite\Platform\Tasks\ScheduleExecutions; use Appwrite\Platform\Tasks\ScheduleFunctions; use Appwrite\Platform\Tasks\ScheduleMessages; +use Appwrite\Platform\Tasks\Screenshot; use Appwrite\Platform\Tasks\SDKs; use Appwrite\Platform\Tasks\Specs; use Appwrite\Platform\Tasks\SSL; @@ -32,6 +33,7 @@ class Tasks extends Service ->addAction(QueueRetry::getName(), new QueueRetry()) ->addAction(SDKs::getName(), new SDKs()) ->addAction(SSL::getName(), new SSL()) + ->addAction(Screenshot::getName(), new Screenshot()) ->addAction(ScheduleFunctions::getName(), new ScheduleFunctions()) ->addAction(ScheduleExecutions::getName(), new ScheduleExecutions()) ->addAction(ScheduleMessages::getName(), new ScheduleMessages()) diff --git a/src/Appwrite/Platform/Services/Workers.php b/src/Appwrite/Platform/Services/Workers.php index eb544c140e..e22f402145 100644 --- a/src/Appwrite/Platform/Services/Workers.php +++ b/src/Appwrite/Platform/Services/Workers.php @@ -3,7 +3,6 @@ namespace Appwrite\Platform\Services; use Appwrite\Platform\Workers\Audits; -use Appwrite\Platform\Workers\Builds; use Appwrite\Platform\Workers\Certificates; use Appwrite\Platform\Workers\Databases; use Appwrite\Platform\Workers\Deletes; @@ -23,7 +22,6 @@ class Workers extends Service $this->type = Service::TYPE_WORKER; $this ->addAction(Audits::getName(), new Audits()) - ->addAction(Builds::getName(), new Builds()) ->addAction(Certificates::getName(), new Certificates()) ->addAction(Databases::getName(), new Databases()) ->addAction(Deletes::getName(), new Deletes()) diff --git a/src/Appwrite/Platform/Tasks/Doctor.php b/src/Appwrite/Platform/Tasks/Doctor.php index c43afea527..790f1a7290 100644 --- a/src/Appwrite/Platform/Tasks/Doctor.php +++ b/src/Appwrite/Platform/Tasks/Doctor.php @@ -15,6 +15,7 @@ use Utopia\Registry\Registry; use Utopia\Storage\Device\Local; use Utopia\Storage\Storage; use Utopia\System\System; +use Utopia\Validator\IP; class Doctor extends Action { @@ -28,7 +29,7 @@ class Doctor extends Action $this ->desc('Validate server health') ->inject('register') - ->callback(fn (Registry $register) => $this->action($register)); + ->callback([$this, 'action']); } public function action(Registry $register): void @@ -43,19 +44,31 @@ class Doctor extends Action Console::log('[Settings]'); $domain = new Domain(System::getEnv('_APP_DOMAIN')); - if (!$domain->isKnown() || $domain->isTest()) { - Console::log('🔴 Hostname has no public suffix (' . $domain->get() . ')'); + Console::log('🔴 Hostname is not valid (' . $domain->get() . ')'); } else { - Console::log('🟢 Hostname has a public suffix (' . $domain->get() . ')'); + Console::log('🟢 Hostname is valid (' . $domain->get() . ')'); } - $domain = new Domain(System::getEnv('_APP_DOMAIN_TARGET')); - + $domain = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME')); if (!$domain->isKnown() || $domain->isTest()) { - Console::log('🔴 CNAME target has no public suffix (' . $domain->get() . ')'); + Console::log('🔴 CNAME record target is not valid (' . $domain->get() . ')'); } else { - Console::log('🟢 CNAME target has a public suffix (' . $domain->get() . ')'); + Console::log('🟢 CNAME record target is valid (' . $domain->get() . ')'); + } + + $ipv4 = new IP(IP::V4); + if (!$ipv4->isValid(System::getEnv('_APP_DOMAIN_TARGET_A'))) { + Console::log('🔴 A record target is not valid (' . System::getEnv('_APP_DOMAIN_TARGET_A') . ')'); + } else { + Console::log('🟢 A record target is valid (' . System::getEnv('_APP_DOMAIN_TARGET_A') . ')'); + } + + $ipv6 = new IP(IP::V6); + if (!$ipv6->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA'))) { + Console::log('🔴 AAAA record target is not valid (' . System::getEnv('_APP_DOMAIN_TARGET_AAAA') . ')'); + } else { + Console::log('🟢 AAAA record target is valid (' . System::getEnv('_APP_DOMAIN_TARGET_AAAA') . ')'); } if (System::getEnv('_APP_OPENSSL_KEY_V1') === 'your-secret-key' || empty(System::getEnv('_APP_OPENSSL_KEY_V1'))) { @@ -96,10 +109,10 @@ class Doctor extends Action Console::log('🟢 HTTPS force option is enabled'); } - if ('enabled' !== System::getEnv('_APP_OPTIONS_FUNCTIONS_FORCE_HTTPS', 'disabled')) { - Console::log('🔴 HTTPS force option is disabled for function domains'); + if ('enabled' !== System::getEnv('_APP_OPTIONS_ROUTER_FORCE_HTTPS', 'disabled')) { + Console::log('🔴 HTTPS force option is disabled for function/site domains'); } else { - Console::log('🟢 HTTPS force option is enabled for function domains'); + Console::log('🟢 HTTPS force option is enabled for function/site domains'); } $providerConfig = System::getEnv('_APP_LOGGING_CONFIG', ''); diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index 4abd267684..c7b1f72453 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -31,7 +31,7 @@ class Install extends Action ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart)); + ->callback([$this, 'action']); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void diff --git a/src/Appwrite/Platform/Tasks/Maintenance.php b/src/Appwrite/Platform/Tasks/Maintenance.php index bb815e50bd..fd9d05dec9 100644 --- a/src/Appwrite/Platform/Tasks/Maintenance.php +++ b/src/Appwrite/Platform/Tasks/Maintenance.php @@ -27,7 +27,7 @@ class Maintenance extends Action ->inject('console') ->inject('queueForCertificates') ->inject('queueForDeletes') - ->callback(fn (Database $dbForPlatform, Document $console, Certificate $queueForCertificates, Delete $queueForDeletes) => $this->action($dbForPlatform, $console, $queueForCertificates, $queueForDeletes)); + ->callback([$this, 'action']); } public function action(Database $dbForPlatform, Document $console, Certificate $queueForCertificates, Delete $queueForDeletes): void diff --git a/src/Appwrite/Platform/Tasks/Migrate.php b/src/Appwrite/Platform/Tasks/Migrate.php index e495ce1d3f..5407c772ab 100644 --- a/src/Appwrite/Platform/Tasks/Migrate.php +++ b/src/Appwrite/Platform/Tasks/Migrate.php @@ -8,11 +8,10 @@ use Utopia\App; use Utopia\CLI\Console; use Utopia\Database\Database; use Utopia\Database\Document; -use Utopia\Database\Query; +use Utopia\Database\Exception; use Utopia\Database\Validator\Authorization; use Utopia\Platform\Action; use Utopia\Registry\Registry; -use Utopia\System\System; use Utopia\Validator\Text; class Migrate extends Action @@ -28,114 +27,75 @@ class Migrate extends Action { $this ->desc('Migrate Appwrite to new version') - /** @TODO APP_VERSION_STABLE needs to be defined */ - ->param('version', APP_VERSION_STABLE, new Text(8), 'Version to migrate to.', true) + ->param('version', APP_VERSION_STABLE, new Text(16), 'Version to migrate to.', true) ->inject('dbForPlatform') ->inject('getProjectDB') ->inject('register') ->callback($this->action(...)); } - private function clearProjectsCache(Document $project) - { - try { - $iterator = null; - do { - $pattern = "default-cache-_{$project->getInternalId()}:*"; - $keys = $this->redis->scan($iterator, $pattern, 1000); - if ($keys !== false) { - foreach ($keys as $key) { - $this->redis->del($key); - } - } - } while ($iterator > 0); - } catch (\Throwable $th) { - Console::error('Failed to clear project ("' . $project->getId() . '") cache with error: ' . $th->getMessage()); - } - } - - public function action(string $version, Database $dbForPlatform, callable $getProjectDB, Registry $register) - { + /** + * @param string $version + * @param Database $dbForPlatform + * @param callable(Document): Database $getProjectDB + * @param Registry $register + * @return void + * @throws Exception + */ + public function action( + string $version, + Database $dbForPlatform, + callable $getProjectDB, + Registry $register, + ): void { Authorization::disable(); - if (!array_key_exists($version, Migration::$versions)) { + + if (!\array_key_exists($version, Migration::$versions)) { Console::error("Version {$version} not found."); Console::exit(1); - return; } - $this->redis = new Redis(); - $this->redis->connect( - System::getEnv('_APP_REDIS_HOST', null), - System::getEnv('_APP_REDIS_PORT', 6379), - 3, - null, - 10 - ); - - $app = new App('UTC'); - Console::success('Starting Data Migration to version ' . $version); - $console = $app->getResource('console'); - - $limit = 30; - $sum = 30; - $offset = 0; - /** - * @var \Utopia\Database\Document[] $projects - */ - $projects = [$console]; - $count = 0; - - try { - $totalProjects = $dbForPlatform->count('projects') + 1; - } catch (\Throwable $th) { - $dbForPlatform->setNamespace('_console'); - $totalProjects = $dbForPlatform->count('projects') + 1; - } - $class = 'Appwrite\\Migration\\Version\\' . Migration::$versions[$version]; + /** @var Migration $migration */ $migration = new $class(); - while (!empty($projects)) { - foreach ($projects as $project) { - /** - * Skip user projects with id 'console' - */ - if ($project->getId() === 'console' && $project->getInternalId() !== 'console') { - continue; - } + $count = 0; + $total = $dbForPlatform->count('projects') + 1; - $this->clearProjectsCache($project); + $dbForPlatform->foreach('projects', function (Document $project) use ($dbForPlatform, $getProjectDB, $register, $migration, &$count, $total) { + /** @var Database $dbForProject */ + $dbForProject = $getProjectDB($project); + $dbForProject->disableValidation(); - try { - // TODO: Iterate through all project DBs - /** @var Database $projectDB */ - $projectDB = $getProjectDB($project); - $projectDB->disableValidation(); - $migration - ->setProject($project, $projectDB, $dbForPlatform) - ->setPDO($register->get('db', true)) - ->execute(); - } catch (\Throwable $th) { - Console::error('Failed to update project ("' . $project->getId() . '") version with error: ' . $th->getMessage()); - throw $th; - } - - $this->clearProjectsCache($project); + try { + $migration + ->setProject($project, $dbForProject, $dbForPlatform, $getProjectDB) + ->setPDO($register->get('db', true)) + ->execute(); + } catch (\Throwable $th) { + Console::error('Failed to migrate project "' . $project->getId() . '" with error: ' . $th->getMessage()); + throw $th; } - $sum = \count($projects); - $projects = $dbForPlatform->find('projects', [Query::limit($limit), Query::offset($offset)]); + Console::log('Migrated ' . ++$count . '/' . $total . ' projects...'); + }); - $offset = $offset + $limit; - $count = $count + $sum; + $console = (new App('UTC'))->getResource('console'); - Console::log('Migrated ' . $count . '/' . $totalProjects . ' projects...'); + try { + $migration + ->setProject($console, $getProjectDB($console), $dbForPlatform, $getProjectDB) + ->setPDO($register->get('db', true)) + ->execute(); + } catch (\Throwable $th) { + Console::error('Failed to migrate project "console" with error: ' . $th->getMessage()); + throw $th; } - Console::success('Data Migration Completed'); + Console::success('Migration completed'); } } diff --git a/src/Appwrite/Platform/Tasks/QueueRetry.php b/src/Appwrite/Platform/Tasks/QueueRetry.php index 9fe4aed799..f8099dcb00 100644 --- a/src/Appwrite/Platform/Tasks/QueueRetry.php +++ b/src/Appwrite/Platform/Tasks/QueueRetry.php @@ -24,7 +24,7 @@ class QueueRetry extends Action ->param('name', '', new Text(100), 'Queue name') ->param('limit', 0, new Wildcard(), 'jobs limit', true) ->inject('publisher') - ->callback(fn ($name, $limit, $publisher) => $this->action($name, $limit, $publisher)); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Tasks/SDKs.php b/src/Appwrite/Platform/Tasks/SDKs.php index 126dcd7fb4..cf917ae96b 100644 --- a/src/Appwrite/Platform/Tasks/SDKs.php +++ b/src/Appwrite/Platform/Tasks/SDKs.php @@ -64,7 +64,7 @@ class SDKs extends Action $message ??= Console::confirm('Please enter your commit message:'); } - if (!in_array($version, ['0.6.x', '0.7.x', '0.8.x', '0.9.x', '0.10.x', '0.11.x', '0.12.x', '0.13.x', '0.14.x', '0.15.x', '1.0.x', '1.1.x', '1.2.x', '1.3.x', '1.4.x', '1.5.x', '1.6.x', 'latest'])) { + if (!in_array($version, ['0.6.x', '0.7.x', '0.8.x', '0.9.x', '0.10.x', '0.11.x', '0.12.x', '0.13.x', '0.14.x', '0.15.x', '1.0.x', '1.1.x', '1.2.x', '1.3.x', '1.4.x', '1.5.x', '1.6.x', '1.7.x', 'latest'])) { throw new \Exception('Unknown version given'); } @@ -250,7 +250,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ->setTwitter(APP_SOCIAL_TWITTER_HANDLE) ->setDiscord(APP_SOCIAL_DISCORD_CHANNEL, APP_SOCIAL_DISCORD) ->setDefaultHeaders([ - 'X-Appwrite-Response-Format' => '1.6.0', + 'X-Appwrite-Response-Format' => '1.7.0', ]); // Make sure we have a clean slate. diff --git a/src/Appwrite/Platform/Tasks/SSL.php b/src/Appwrite/Platform/Tasks/SSL.php index 5af0cb6cd8..ae1c93a360 100644 --- a/src/Appwrite/Platform/Tasks/SSL.php +++ b/src/Appwrite/Platform/Tasks/SSL.php @@ -24,7 +24,7 @@ class SSL extends Action ->param('domain', System::getEnv('_APP_DOMAIN', ''), new Hostname(), 'Domain to generate certificate for. If empty, main domain will be used.', true) ->param('skip-check', true, new Boolean(true), 'If DNS and renew check should be skipped. Defaults to true, and when true, all jobs will result in certificate generation attempt.', true) ->inject('queueForCertificates') - ->callback(fn (string $domain, bool|string $skipCheck, Certificate $queueForCertificates) => $this->action($domain, $skipCheck, $queueForCertificates)); + ->callback([$this, 'action']); } public function action(string $domain, bool|string $skipCheck, Certificate $queueForCertificates): void diff --git a/src/Appwrite/Platform/Tasks/ScheduleBase.php b/src/Appwrite/Platform/Tasks/ScheduleBase.php index 8f7eab4d87..3cf89f9f44 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleBase.php +++ b/src/Appwrite/Platform/Tasks/ScheduleBase.php @@ -50,7 +50,7 @@ abstract class ScheduleBase extends Action protected function updateProjectAccess(Document $project, Database $dbForPlatform): void { if (!$project->isEmpty() && $project->getId() !== 'console') { - $accessedAt = $project->getAttribute('accessedAt', ''); + $accessedAt = $project->getAttribute('accessedAt', 0); if (DateTime::formatTz(DateTime::addSeconds(new \DateTime(), -APP_PROJECT_ACCESS)) > $accessedAt) { $project->setAttribute('accessedAt', DateTime::now()); Authorization::skip(fn () => $dbForPlatform->updateDocument('projects', $project->getId(), $project)); diff --git a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php index 89d1609a33..2a8fd99b7f 100644 --- a/src/Appwrite/Platform/Tasks/ScheduleExecutions.php +++ b/src/Appwrite/Platform/Tasks/ScheduleExecutions.php @@ -65,7 +65,7 @@ class ScheduleExecutions extends ScheduleBase $queueForFunctions->setType('schedule') // Set functionId instead of function as we don't have $dbForProject // TODO: Refactor to use function instead of functionId - ->setFunctionId($schedule['resource']['functionId']) + ->setFunctionId($schedule['resource']['resourceId']) ->setExecution($schedule['resource']) ->setMethod($data['method'] ?? 'POST') ->setPath($data['path'] ?? '/') diff --git a/src/Appwrite/Platform/Tasks/Screenshot.php b/src/Appwrite/Platform/Tasks/Screenshot.php new file mode 100644 index 0000000000..3a9c9a64f5 --- /dev/null +++ b/src/Appwrite/Platform/Tasks/Screenshot.php @@ -0,0 +1,312 @@ +<?php + +namespace Appwrite\Platform\Tasks; + +use Appwrite\ID; +use Tests\E2E\Client; +use Utopia\CLI\Console; +use Utopia\Config\Config; +use Utopia\Platform\Action; +use Utopia\Validator\Text; + +class Screenshot extends Action +{ + public static function getName(): string + { + return 'screenshot'; + } + + public function __construct() + { + $this + ->desc('Create Site template screenshot') + ->param('templateId', '', new Text(128), 'Template ID.') + ->callback([$this, 'action']); + } + + public function action(string $templateId): void + { + $templates = Config::getParam('templates-site', []); + + $allowedTemplates = \array_filter($templates, function ($item) use ($templateId) { + return $item['key'] === $templateId; + }); + $template = \array_shift($allowedTemplates); + + if (empty($template)) { + throw new \Exception("Template {$templateId} not found. Find correct ID in app/config/templates/site.php"); + } + + Console::info("Found: " . $template['name']); + + $client = new Client(); + $client->setEndpoint('http://localhost/v1'); + $client->addHeader('origin', 'http://localhost'); + + // Register + $email = uniqid() . 'user@localhost.test'; + $password = 'password'; + + Console::info("Email: {$email}"); + Console::info("Pass: {$password}"); + + $user = $client->call(Client::METHOD_POST, '/account', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + ], [ + 'userId' => ID::unique(), + 'email' => $email, + 'password' => $password, + ]); + + if ($user['headers']['status-code'] !== 201) { + Console::error(\json_encode($user)); + throw new \Exception("Failed to register user"); + } + + Console::info("User created"); + + // Login + $session = $client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + ], [ + 'email' => $email, + 'password' => $password, + ]); + + if ($session['headers']['status-code'] !== 201) { + Console::error(\json_encode($session)); + throw new \Exception("Failed to login user"); + } + + Console::info("Session created"); + + $secret = $session['cookies']['a_session_console']; + $cookieConsole = 'a_session_console=' . $secret; + + // Create organization + $team = $client->call(Client::METHOD_POST, '/teams', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + 'cookie' => $cookieConsole + ], [ + 'teamId' => ID::unique(), + 'name' => 'Demo Project Team', + ]); + + if ($team['headers']['status-code'] !== 201) { + Console::error(\json_encode($team)); + throw new \Exception("Failed to create team"); + } + + Console::info("Team created"); + + $projectName = 'Demo Project'; + $projectId = ID::unique(); + + // Create project + $project = $client->call(Client::METHOD_POST, '/projects', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + 'cookie' => $cookieConsole + ], [ + 'projectId' => $projectId, + 'region' => 'default', + 'name' => $projectName, + 'teamId' => $team['body']['$id'], + 'description' => 'Demo Project Description', + 'url' => 'https://appwrite.io', + ]); + + if ($project['headers']['status-code'] !== 201) { + Console::error(\json_encode($project)); + throw new \Exception("Failed to create project"); + } + + Console::info("Project created"); + + $projectId = $project['body']['$id']; + + $framework = $template['frameworks'][0]; + + // Create site + $site = $client->call(Client::METHOD_POST, '/sites', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-mode' => 'admin', + 'cookie' => $cookieConsole + ], [ + 'siteId' => ID::unique(), + 'name' => $template["name"], + 'framework' => $framework['key'], + 'adapter' => $framework['adapter'], + 'buildCommand' => $framework['buildCommand'] ?? '', + 'buildRuntime' => $framework['buildRuntime'], + 'fallbackFile' => $framework['fallbackFile'] ?? '', + 'installCommand' => $framework['installCommand'] ?? '', + 'outputDirectory' => $framework['outputDirectory'] ?? '', + 'providerRootDirectory' => $framework['providerRootDirectory'], + 'timeout' => 30 + ]); + + if ($site['headers']['status-code'] !== 201) { + Console::error(\json_encode($site)); + throw new \Exception("Failed to create site"); + } + + Console::info("Site created"); + + $siteId = $site['body']['$id']; + + // Create variables + if (!empty($template['variables'] ?? [])) { + foreach ($template['variables'] as $variable) { + if (empty($variable['value'] ?? '')) { + if (($variable['required'] ?? false) === true) { + throw new \Exception("Missing required variable: {$variable['name']}"); + } + + continue; + } + + $value = $variable['value']; + $value = \str_replace('{projectName}', $projectName, $value); + $value = \str_replace('{projectId}', $projectId, $value); + $value = \str_replace('{apiEndpoint}', 'http://localhost/v1', $value); + + $response = $client->call(Client::METHOD_POST, '/sites/' . $siteId . '/variables', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-mode' => 'admin', + 'cookie' => $cookieConsole + ], [ + 'key' => $variable['name'], + 'value' => $value + ]); + + if ($response['headers']['status-code'] !== 201) { + Console::error(\json_encode($response)); + throw new \Exception("Failed to create variable"); + } + } + + Console::info("Variables created"); + } + + // Create deployment + $deployment = $client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments/template', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-mode' => 'admin', + 'cookie' => $cookieConsole + ], [ + 'owner' => $template['providerOwner'], + 'repository' => $template['providerRepositoryId'], + 'rootDirectory' => $framework['providerRootDirectory'], + 'version' => $template['providerVersion'], + 'activate' => true, + ]); + + if ($deployment['headers']['status-code'] !== 202) { + Console::error(\json_encode($deployment)); + throw new \Exception("Failed to create deployment"); + } + + Console::info("Deployment created"); + + $deploymentId = $deployment['body']['$id']; + + // Await screenshot + $attempts = 60; // 5 min + $sleep = 5; + + $idLight = ''; + $idDark = ''; + + $slowTemplates = [ + 'starter-for-react-native', + 'playground-for-react-native' + ]; + if (\in_array($templateId, $slowTemplates)) { + Console::warning("Build for this template is slow, increasing waiting time ..."); + $attempts = 180; // 15 min + } + + Console::log("Awaiting deployment (every $sleep seconds, $attempts attempts)"); + + for ($i = 0; $i < $attempts; $i++) { + $deployment = $client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-mode' => 'admin', + 'cookie' => $cookieConsole + ]); + + if ($deployment['headers']['status-code'] !== 200) { + Console::error(\json_encode($deployment)); + throw new \Exception("Failed to get deployment"); + } + + if ($deployment['body']['status'] === 'failed') { + Console::error(\json_encode($deployment)); + throw new \Exception("Deployment build failed"); + } + + if ($deployment['body']['status'] !== 'ready') { + Console::log("Deployment not ready yet, status: " . $deployment['body']['status']); + \sleep($sleep); + continue; + } + + + if (empty($deployment['body']['screenshotLight'])) { + Console::log("Light screenshot not available yet"); + \sleep($sleep); + continue; + } + + if (empty($deployment['body']['screenshotDark'])) { + Console::log("Dark screenshot not available yet"); + \sleep($sleep); + continue; + } + + $idLight = $deployment['body']['screenshotLight']; + $idDark = $deployment['body']['screenshotDark']; + break; + } + + if (empty($idLight) || empty($idDark)) { + Console::error(\json_encode($deployment)); + throw new \Exception("Failed to get deployment screenshot"); + } + + Console::info("Screenshots created"); + + $themes = [ + [ 'fileId' => $idLight, 'suffix' => 'light' ], + [ 'fileId' => $idDark, 'suffix' => 'dark' ] + ]; + + foreach ($themes as $theme) { + $file = $client->call(Client::METHOD_GET, '/storage/buckets/screenshots/files/' . $theme['fileId'] . '/download', [ + 'x-appwrite-project' => 'console', + 'cookie' => $cookieConsole + ]); + + if ($file['headers']['status-code'] !== 200) { + Console::error(\json_encode($file)); + throw new \Exception("Failed to download {$theme['suffix']} screenshot"); + } + + $path = "/usr/src/code/public/images/sites/templates/{$template['key']}-{$theme['suffix']}.png"; + + if (!\file_put_contents($path, $file['body'])) { + throw new \Exception("Failed to save {$theme['suffix']} screenshot"); + } + } + + Console::success("Screenshots saved"); + } +} diff --git a/src/Appwrite/Platform/Tasks/Upgrade.php b/src/Appwrite/Platform/Tasks/Upgrade.php index 341ce42fc4..dfd10d347e 100644 --- a/src/Appwrite/Platform/Tasks/Upgrade.php +++ b/src/Appwrite/Platform/Tasks/Upgrade.php @@ -23,7 +23,7 @@ class Upgrade extends Install ->param('image', 'appwrite', new Text(0), 'Main appwrite docker image', true) ->param('interactive', 'Y', new Text(1), 'Run an interactive session', true) ->param('no-start', false, new Boolean(true), 'Run an interactive session', true) - ->callback(fn ($httpPort, $httpsPort, $organization, $image, $interactive, $noStart) => $this->action($httpPort, $httpsPort, $organization, $image, $interactive, $noStart)); + ->callback([$this, 'action']); } public function action(string $httpPort, string $httpsPort, string $organization, string $image, string $interactive, bool $noStart): void diff --git a/src/Appwrite/Platform/Tasks/Vars.php b/src/Appwrite/Platform/Tasks/Vars.php index 499f8b15ec..70ae550ef9 100644 --- a/src/Appwrite/Platform/Tasks/Vars.php +++ b/src/Appwrite/Platform/Tasks/Vars.php @@ -18,7 +18,7 @@ class Vars extends Action { $this ->desc('List all the server environment variables') - ->callback(fn () => $this->action()); + ->callback([$this, 'action']); } public function action(): void diff --git a/src/Appwrite/Platform/Workers/Builds.php b/src/Appwrite/Platform/Workers/Builds.php deleted file mode 100644 index 4057d4b190..0000000000 --- a/src/Appwrite/Platform/Workers/Builds.php +++ /dev/null @@ -1,813 +0,0 @@ -<?php - -namespace Appwrite\Platform\Workers; - -use Ahc\Jwt\JWT; -use Appwrite\Event\Event; -use Appwrite\Event\Func; -use Appwrite\Event\Realtime; -use Appwrite\Event\StatsUsage; -use Appwrite\Event\Webhook; -use Appwrite\Utopia\Response\Model\Deployment; -use Appwrite\Vcs\Comment; -use Exception; -use Executor\Executor; -use Swoole\Coroutine as Co; -use Utopia\Cache\Cache; -use Utopia\CLI\Console; -use Utopia\Config\Config; -use Utopia\Database\Database; -use Utopia\Database\DateTime; -use Utopia\Database\Document; -use Utopia\Database\Exception\Conflict; -use Utopia\Database\Exception\Restricted; -use Utopia\Database\Exception\Structure; -use Utopia\Database\Helpers\ID; -use Utopia\Database\Validator\Authorization; -use Utopia\Logger\Log; -use Utopia\Platform\Action; -use Utopia\Queue\Message; -use Utopia\Storage\Device; -use Utopia\Storage\Device\Local; -use Utopia\System\System; -use Utopia\VCS\Adapter\Git\GitHub; - -class Builds extends Action -{ - public static function getName(): string - { - return 'builds'; - } - - /** - * @throws Exception - */ - public function __construct() - { - $this - ->desc('Builds worker') - ->inject('message') - ->inject('project') - ->inject('dbForPlatform') - ->inject('queueForEvents') - ->inject('queueForWebhooks') - ->inject('queueForFunctions') - ->inject('queueForRealtime') - ->inject('queueForStatsUsage') - ->inject('cache') - ->inject('dbForProject') - ->inject('deviceForFunctions') - ->inject('isResourceBlocked') - ->inject('log') - ->inject('executor') - ->callback(fn ($message, Document $project, Database $dbForPlatform, Event $queueForEvents, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, StatsUsage $usage, Cache $cache, Database $dbForProject, Device $deviceForFunctions, callable $isResourceBlocked, Log $log, Executor $executor) => - $this->action($message, $project, $dbForPlatform, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $usage, $cache, $dbForProject, $deviceForFunctions, $isResourceBlocked, $log, $executor)); - } - - /** - * @param Message $message - * @param Document $project - * @param Database $dbForPlatform - * @param Event $queueForEvents - * @param Webhook $queueForWebhooks - * @param Func $queueForFunctions - * @param Realtime $queueForRealtime - * @param StatsUsage $queueForStatsUsage - * @param Cache $cache - * @param Database $dbForProject - * @param Device $deviceForFunctions - * @param Log $log - * @param Executor $executor - * @return void - * @throws \Utopia\Database\Exception - */ - public function action(Message $message, Document $project, Database $dbForPlatform, Event $queueForEvents, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, StatsUsage $queueForStatsUsage, Cache $cache, Database $dbForProject, Device $deviceForFunctions, callable $isResourceBlocked, Log $log, Executor $executor): void - { - $payload = $message->getPayload() ?? []; - - if (empty($payload)) { - throw new \Exception('Missing payload'); - } - - $type = $payload['type'] ?? ''; - $resource = new Document($payload['resource'] ?? []); - $deployment = new Document($payload['deployment'] ?? []); - $template = new Document($payload['template'] ?? []); - - $log->addTag('projectId', $project->getId()); - $log->addTag('type', $type); - - switch ($type) { - case BUILD_TYPE_DEPLOYMENT: - case BUILD_TYPE_RETRY: - Console::info('Creating build for deployment: ' . $deployment->getId()); - $github = new GitHub($cache); - $this->buildDeployment($deviceForFunctions, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $queueForEvents, $queueForStatsUsage, $dbForPlatform, $dbForProject, $github, $project, $resource, $deployment, $template, $isResourceBlocked, $log, $executor); - break; - - default: - throw new \Exception('Invalid build type'); - } - } - - /** - * @param Device $deviceForFunctions - * @param Webhook $queueForWebhooks - * @param Func $queueForFunctions - * @param Realtime $queueForRealtime - * @param Event $queueForEvents - * @param StatsUsage $queueForStatsUsage - * @param Database $dbForPlatform - * @param Database $dbForProject - * @param GitHub $github - * @param Document $project - * @param Document $function - * @param Document $deployment - * @param Document $template - * @param Log $log - * @param Executor $executor - * @return void - * @throws \Utopia\Database\Exception - * @throws Exception - */ - protected function buildDeployment(Device $deviceForFunctions, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, Event $queueForEvents, StatsUsage $queueForStatsUsage, Database $dbForPlatform, Database $dbForProject, GitHub $github, Document $project, Document $function, Document $deployment, Document $template, callable $isResourceBlocked, Log $log, Executor $executor): void - { - $functionId = $function->getId(); - $log->addTag('functionId', $function->getId()); - - $function = $dbForProject->getDocument('functions', $functionId); - if ($function->isEmpty()) { - throw new \Exception('Function not found'); - } - - if ($isResourceBlocked($project, RESOURCE_TYPE_FUNCTIONS, $functionId)) { - throw new \Exception('Function blocked'); - } - - $deploymentId = $deployment->getId(); - $log->addTag('deploymentId', $deploymentId); - - $deployment = $dbForProject->getDocument('deployments', $deploymentId); - if ($deployment->isEmpty()) { - throw new \Exception('Deployment not found'); - } - - if (empty($deployment->getAttribute('entrypoint', ''))) { - throw new \Exception('Entrypoint for your Appwrite Function is missing. Please specify it when making deployment or update the entrypoint under your function\'s "Settings" > "Configuration" > "Entrypoint".'); - } - - $version = $function->getAttribute('version', 'v2'); - $spec = Config::getParam('runtime-specifications')[$function->getAttribute('specification', APP_FUNCTION_SPECIFICATION_DEFAULT)]; - $runtimes = Config::getParam($version === 'v2' ? 'runtimes-v2' : 'runtimes', []); - $key = $function->getAttribute('runtime'); - $runtime = $runtimes[$key] ?? null; - if (\is_null($runtime)) { - throw new \Exception('Runtime "' . $function->getAttribute('runtime', '') . '" is not supported'); - } - - // Realtime preparation - $event = "functions.[functionId].deployments.[deploymentId].update"; - - $startTime = DateTime::now(); - $durationStart = \microtime(true); - $buildId = $deployment->getAttribute('buildId', ''); - $build = $dbForProject->getDocument('builds', $buildId); - $isNewBuild = empty($buildId); - if ($build->isEmpty()) { - $buildId = ID::unique(); - $build = $dbForProject->createDocument('builds', new Document([ - '$id' => $buildId, - '$permissions' => [], - 'startTime' => $startTime, - 'deploymentInternalId' => $deployment->getInternalId(), - 'deploymentId' => $deployment->getId(), - 'status' => 'processing', - 'path' => '', - 'runtime' => $function->getAttribute('runtime'), - 'source' => $deployment->getAttribute('path', ''), - 'sourceType' => strtolower($deviceForFunctions->getType()), - 'logs' => '', - 'endTime' => null, - 'duration' => 0, - 'size' => 0 - ])); - - $deployment->setAttribute('buildId', $build->getId()); - $deployment->setAttribute('buildInternalId', $build->getInternalId()); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); - } elseif ($build->getAttribute('status') === 'canceled') { - Console::info('Build has been canceled'); - return; - } else { - $build = $dbForProject->getDocument('builds', $buildId); - } - - $source = $deployment->getAttribute('path', ''); - $installationId = $deployment->getAttribute('installationId', ''); - $providerRepositoryId = $deployment->getAttribute('providerRepositoryId', ''); - $providerCommitHash = $deployment->getAttribute('providerCommitHash', ''); - $isVcsEnabled = !empty($providerRepositoryId); - $owner = ''; - $repositoryName = ''; - - if ($isVcsEnabled) { - $installation = $dbForPlatform->getDocument('installations', $installationId); - $providerInstallationId = $installation->getAttribute('providerInstallationId'); - $privateKey = System::getEnv('_APP_VCS_GITHUB_PRIVATE_KEY'); - $githubAppId = System::getEnv('_APP_VCS_GITHUB_APP_ID'); - - $github->initializeVariables($providerInstallationId, $privateKey, $githubAppId); - } - - try { - if ($isNewBuild && !$isVcsEnabled) { - // Non-VCS + Template - $templateRepositoryName = $template->getAttribute('repositoryName', ''); - $templateOwnerName = $template->getAttribute('ownerName', ''); - $templateVersion = $template->getAttribute('version', ''); - - $templateRootDirectory = $template->getAttribute('rootDirectory', ''); - $templateRootDirectory = \rtrim($templateRootDirectory, '/'); - $templateRootDirectory = \ltrim($templateRootDirectory, '.'); - $templateRootDirectory = \ltrim($templateRootDirectory, '/'); - - if (!empty($templateRepositoryName) && !empty($templateOwnerName) && !empty($templateVersion)) { - $stdout = ''; - $stderr = ''; - - // Clone template repo - $tmpTemplateDirectory = '/tmp/builds/' . $buildId . '-template'; - $gitCloneCommandForTemplate = $github->generateCloneCommand($templateOwnerName, $templateRepositoryName, $templateVersion, GitHub::CLONE_TYPE_TAG, $tmpTemplateDirectory, $templateRootDirectory); - $exit = Console::execute($gitCloneCommandForTemplate, '', $stdout, $stderr); - - if ($exit !== 0) { - throw new \Exception('Unable to clone code repository: ' . $stderr); - } - - Console::execute('find ' . \escapeshellarg($tmpTemplateDirectory) . ' -type d -name ".git" -exec rm -rf {} +', '', $stdout, $stderr); - - // Ensure directories - Console::execute('mkdir -p ' . \escapeshellarg($tmpTemplateDirectory . '/' . $templateRootDirectory), '', $stdout, $stderr); - - $tmpPathFile = $tmpTemplateDirectory . '/code.tar.gz'; - - $localDevice = new Local(); - - if (substr($tmpTemplateDirectory, -1) !== '/') { - $tmpTemplateDirectory .= '/'; - } - - $tarParamDirectory = \escapeshellarg($tmpTemplateDirectory . (empty($templateRootDirectory) ? '' : '/' . $templateRootDirectory)); - Console::execute('tar --exclude code.tar.gz -czf ' . \escapeshellarg($tmpPathFile) . ' -C ' . \escapeshellcmd($tarParamDirectory) . ' .', '', $stdout, $stderr); // TODO: Replace escapeshellcmd with escapeshellarg if we find a way that doesnt break syntax - - $source = $deviceForFunctions->getPath($deployment->getId() . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION)); - $result = $localDevice->transfer($tmpPathFile, $source, $deviceForFunctions); - - if (!$result) { - throw new \Exception("Unable to move file"); - } - - Console::execute('rm -rf ' . \escapeshellarg($tmpTemplateDirectory), '', $stdout, $stderr); - - $directorySize = $deviceForFunctions->getFileSize($source); - $build = $dbForProject->updateDocument('builds', $build->getId(), $build->setAttribute('source', $source)); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment->setAttribute('path', $source)->setAttribute('size', $directorySize)); - } - } elseif ($isNewBuild && $isVcsEnabled) { - // VCS and VCS+Temaplte - $tmpDirectory = '/tmp/builds/' . $buildId . '/code'; - $rootDirectory = $function->getAttribute('providerRootDirectory', ''); - $rootDirectory = \rtrim($rootDirectory, '/'); - $rootDirectory = \ltrim($rootDirectory, '.'); - $rootDirectory = \ltrim($rootDirectory, '/'); - - $owner = $github->getOwnerName($providerInstallationId); - $repositoryName = $github->getRepositoryName($providerRepositoryId); - - $cloneOwner = $deployment->getAttribute('providerRepositoryOwner', $owner); - $cloneRepository = $deployment->getAttribute('providerRepositoryName', $repositoryName); - - $branchName = $deployment->getAttribute('providerBranch'); - $commitHash = $deployment->getAttribute('providerCommitHash', ''); - - $cloneVersion = $branchName; - $cloneType = GitHub::CLONE_TYPE_BRANCH; - if (!empty($commitHash)) { - $cloneVersion = $commitHash; - $cloneType = GitHub::CLONE_TYPE_COMMIT; - } - - $gitCloneCommand = $github->generateCloneCommand($cloneOwner, $cloneRepository, $cloneVersion, $cloneType, $tmpDirectory, $rootDirectory); - $stdout = ''; - $stderr = ''; - - Console::execute('mkdir -p ' . \escapeshellarg('/tmp/builds/' . $buildId), '', $stdout, $stderr); - - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { - Console::info('Build has been canceled'); - return; - } - - $exit = Console::execute($gitCloneCommand, '', $stdout, $stderr); - - if ($exit !== 0) { - throw new \Exception('Unable to clone code repository: ' . $stderr); - } - - // Local refactoring for function folder with spaces - if (str_contains($rootDirectory, ' ')) { - $rootDirectoryWithoutSpaces = str_replace(' ', '', $rootDirectory); - $from = $tmpDirectory . '/' . $rootDirectory; - $to = $tmpDirectory . '/' . $rootDirectoryWithoutSpaces; - $exit = Console::execute('mv "' . \escapeshellarg($from) . '" "' . \escapeshellarg($to) . '"', '', $stdout, $stderr); - - if ($exit !== 0) { - throw new \Exception('Unable to move function with spaces' . $stderr); - } - $rootDirectory = $rootDirectoryWithoutSpaces; - } - - - // Build from template - $templateRepositoryName = $template->getAttribute('repositoryName', ''); - $templateOwnerName = $template->getAttribute('ownerName', ''); - $templateVersion = $template->getAttribute('version', ''); - - $templateRootDirectory = $template->getAttribute('rootDirectory', ''); - $templateRootDirectory = \rtrim($templateRootDirectory, '/'); - $templateRootDirectory = \ltrim($templateRootDirectory, '.'); - $templateRootDirectory = \ltrim($templateRootDirectory, '/'); - - if (!empty($templateRepositoryName) && !empty($templateOwnerName) && !empty($templateVersion)) { - // Clone template repo - $tmpTemplateDirectory = '/tmp/builds/' . $buildId . '/template'; - - $gitCloneCommandForTemplate = $github->generateCloneCommand($templateOwnerName, $templateRepositoryName, $templateVersion, GitHub::CLONE_TYPE_TAG, $tmpTemplateDirectory, $templateRootDirectory); - $exit = Console::execute($gitCloneCommandForTemplate, '', $stdout, $stderr); - - if ($exit !== 0) { - throw new \Exception('Unable to clone code repository: ' . $stderr); - } - - // Ensure directories - Console::execute('mkdir -p ' . \escapeshellarg($tmpTemplateDirectory . '/' . $templateRootDirectory), '', $stdout, $stderr); - Console::execute('mkdir -p ' . \escapeshellarg($tmpDirectory . '/' . $rootDirectory), '', $stdout, $stderr); - - // Merge template into user repo - Console::execute('rsync -av --exclude \'.git\' ' . \escapeshellarg($tmpTemplateDirectory . '/' . $templateRootDirectory . '/') . ' ' . \escapeshellarg($tmpDirectory . '/' . $rootDirectory), '', $stdout, $stderr); - - // Commit and push - $exit = Console::execute('git config --global user.email "team@appwrite.io" && git config --global user.name "Appwrite" && cd ' . \escapeshellarg($tmpDirectory) . ' && git add . && git commit -m "Create ' . \escapeshellarg($function->getAttribute('name', '')) . ' function" && git push origin ' . \escapeshellarg($branchName), '', $stdout, $stderr); - - if ($exit !== 0) { - throw new \Exception('Unable to push code repository: ' . $stderr); - } - - $exit = Console::execute('cd ' . \escapeshellarg($tmpDirectory) . ' && git rev-parse HEAD', '', $stdout, $stderr); - - if ($exit !== 0) { - throw new \Exception('Unable to get vcs commit SHA: ' . $stderr); - } - - $providerCommitHash = \trim($stdout); - $authorUrl = "https://github.com/$cloneOwner"; - - $deployment->setAttribute('providerCommitHash', $providerCommitHash ?? ''); - $deployment->setAttribute('providerCommitAuthorUrl', $authorUrl); - $deployment->setAttribute('providerCommitAuthor', 'Appwrite'); - $deployment->setAttribute('providerCommitMessage', "Create '" . $function->getAttribute('name', '') . "' function"); - $deployment->setAttribute('providerCommitUrl', "https://github.com/$cloneOwner/$cloneRepository/commit/$providerCommitHash"); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment); - - /** - * Trigger Realtime Event - */ - $queueForRealtime - ->setProject($project) - ->setSubscribers(['console']) - ->setEvent($event) - ->setParam('functionId', $function->getId()) - ->setParam('deploymentId', $deployment->getId()) - ->setPayload($build->getArrayCopy()) - ->trigger(); - } - - $tmpPath = '/tmp/builds/' . $buildId; - $tmpPathFile = $tmpPath . '/code.tar.gz'; - $localDevice = new Local(); - - if (substr($tmpDirectory, -1) !== '/') { - $tmpDirectory .= '/'; - } - - $directorySize = $localDevice->getDirectorySize($tmpDirectory); - $functionsSizeLimit = (int)System::getEnv('_APP_FUNCTIONS_SIZE_LIMIT', '30000000'); - if ($directorySize > $functionsSizeLimit) { - throw new \Exception('Repository directory size should be less than ' . number_format($functionsSizeLimit / 1048576, 2) . ' MBs.'); - } - - Console::execute('find ' . \escapeshellarg($tmpDirectory) . ' -type d -name ".git" -exec rm -rf {} +', '', $stdout, $stderr); - - $tarParamDirectory = '/tmp/builds/' . $buildId . '/code' . (empty($rootDirectory) ? '' : '/' . $rootDirectory); - Console::execute('tar --exclude code.tar.gz -czf ' . \escapeshellarg($tmpPathFile) . ' -C ' . \escapeshellcmd($tarParamDirectory) . ' .', '', $stdout, $stderr); // TODO: Replace escapeshellcmd with escapeshellarg if we find a way that doesnt break syntax - - $source = $deviceForFunctions->getPath($deployment->getId() . '.' . \pathinfo('code.tar.gz', PATHINFO_EXTENSION)); - $result = $localDevice->transfer($tmpPathFile, $source, $deviceForFunctions); - - if (!$result) { - throw new \Exception("Unable to move file"); - } - - Console::execute('rm -rf ' . \escapeshellarg($tmpPath), '', $stdout, $stderr); - - $build = $dbForProject->updateDocument('builds', $build->getId(), $build->setAttribute('source', $source)); - - $directorySize = $deviceForFunctions->getFileSize($source); - $deployment = $dbForProject->updateDocument('deployments', $deployment->getId(), $deployment->setAttribute('path', $source)->setAttribute('size', $directorySize)); - - $this->runGitAction('processing', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForPlatform); - } - - /** Request the executor to build the code... */ - $build->setAttribute('status', 'building'); - $build = $dbForProject->updateDocument('builds', $buildId, $build); - - if ($isVcsEnabled) { - $this->runGitAction('building', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForPlatform); - } - - $deploymentModel = new Deployment(); - $deploymentUpdate = - $queueForEvents - ->setProject($project) - ->setEvent('functions.[functionId].deployments.[deploymentId].update') - ->setParam('functionId', $function->getId()) - ->setParam('deploymentId', $deployment->getId()) - ->setPayload($deployment->getArrayCopy(array_keys($deploymentModel->getRules()))); - - /** Trigger Webhook */ - $queueForWebhooks - ->from($deploymentUpdate) - ->trigger(); - - /** Trigger Functions */ - $queueForFunctions - ->from($deploymentUpdate) - ->trigger(); - - /** Trigger Realtime Event */ - $queueForRealtime - ->setProject($project) - ->setSubscribers(['console']) - ->setEvent($event) - ->setParam('functionId', $function->getId()) - ->setParam('deploymentId', $deployment->getId()) - ->setPayload($build->getArrayCopy()) - ->trigger(); - - $vars = []; - - // Shared vars - foreach ($function->getAttribute('varsProject', []) as $var) { - $vars[$var->getAttribute('key')] = $var->getAttribute('value', ''); - } - - // Function vars - foreach ($function->getAttribute('vars', []) as $var) { - $vars[$var->getAttribute('key')] = $var->getAttribute('value', ''); - } - - $cpus = $spec['cpus'] ?? APP_FUNCTION_CPUS_DEFAULT; - $memory = max($spec['memory'] ?? APP_FUNCTION_MEMORY_DEFAULT, 1024); // We have a minimum of 1024MB here because some runtimes can't compile with less memory than this. - - $jwtExpiry = (int)System::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900); - $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', $jwtExpiry, 0); - $apiKey = $jwtObj->encode([ - 'projectId' => $project->getId(), - 'scopes' => $function->getAttribute('scopes', []) - ]); - - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_DOMAIN'); - $endpoint = $protocol . '://' . $hostname . "/v1"; - - // Appwrite vars - $vars = \array_merge($vars, [ - 'APPWRITE_FUNCTION_API_ENDPOINT' => $endpoint, - 'APPWRITE_FUNCTION_API_KEY' => API_KEY_DYNAMIC . '_' . $apiKey, - 'APPWRITE_FUNCTION_ID' => $function->getId(), - 'APPWRITE_FUNCTION_NAME' => $function->getAttribute('name'), - 'APPWRITE_FUNCTION_DEPLOYMENT' => $deployment->getId(), - 'APPWRITE_FUNCTION_PROJECT_ID' => $project->getId(), - 'APPWRITE_FUNCTION_RUNTIME_NAME' => $runtime['name'] ?? '', - 'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'] ?? '', - 'APPWRITE_FUNCTION_CPUS' => $cpus, - 'APPWRITE_FUNCTION_MEMORY' => $memory, - 'APPWRITE_VERSION' => APP_VERSION_STABLE, - 'APPWRITE_REGION' => $project->getAttribute('region'), - 'APPWRITE_DEPLOYMENT_TYPE' => $deployment->getAttribute('type', ''), - 'APPWRITE_VCS_REPOSITORY_ID' => $deployment->getAttribute('providerRepositoryId', ''), - 'APPWRITE_VCS_REPOSITORY_NAME' => $deployment->getAttribute('providerRepositoryName', ''), - 'APPWRITE_VCS_REPOSITORY_OWNER' => $deployment->getAttribute('providerRepositoryOwner', ''), - 'APPWRITE_VCS_REPOSITORY_URL' => $deployment->getAttribute('providerRepositoryUrl', ''), - 'APPWRITE_VCS_REPOSITORY_BRANCH' => $deployment->getAttribute('providerBranch', ''), - 'APPWRITE_VCS_REPOSITORY_BRANCH_URL' => $deployment->getAttribute('providerBranchUrl', ''), - 'APPWRITE_VCS_COMMIT_HASH' => $deployment->getAttribute('providerCommitHash', ''), - 'APPWRITE_VCS_COMMIT_MESSAGE' => $deployment->getAttribute('providerCommitMessage', ''), - 'APPWRITE_VCS_COMMIT_URL' => $deployment->getAttribute('providerCommitUrl', ''), - 'APPWRITE_VCS_COMMIT_AUTHOR_NAME' => $deployment->getAttribute('providerCommitAuthor', ''), - 'APPWRITE_VCS_COMMIT_AUTHOR_URL' => $deployment->getAttribute('providerCommitAuthorUrl', ''), - 'APPWRITE_VCS_ROOT_DIRECTORY' => $deployment->getAttribute('providerRootDirectory', ''), - ]); - - $command = $deployment->getAttribute('commands', ''); - - $response = null; - $err = null; - - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { - Console::info('Build has been canceled'); - return; - } - - $isCanceled = false; - - Co::join([ - Co\go(function () use ($executor, &$response, $project, $deployment, $source, $function, $runtime, $vars, $command, $cpus, $memory, &$err) { - try { - $version = $function->getAttribute('version', 'v2'); - $command = $version === 'v2' ? 'tar -zxf /tmp/code.tar.gz -C /usr/code && cd /usr/local/src/ && ./build.sh' : 'tar -zxf /tmp/code.tar.gz -C /mnt/code && helpers/build.sh "' . \trim(\escapeshellarg($command), "\'") . '"'; - - $response = $executor->createRuntime( - deploymentId: $deployment->getId(), - projectId: $project->getId(), - source: $source, - image: $runtime['image'], - version: $version, - cpus: $cpus, - memory: $memory, - remove: true, - entrypoint: $deployment->getAttribute('entrypoint'), - destination: APP_STORAGE_BUILDS . "/app-{$project->getId()}", - variables: $vars, - command: $command - ); - } catch (\Throwable $error) { - $err = $error; - } - }), - Co\go(function () use ($executor, $project, $function, $deployment, &$response, &$build, $dbForProject, $event, &$err, $queueForRealtime, &$isCanceled) { - try { - $executor->getLogs( - deploymentId: $deployment->getId(), - projectId: $project->getId(), - callback: function ($logs) use (&$response, &$err, &$build, $dbForProject, $event, $project, $function, $deployment, $queueForRealtime, &$isCanceled) { - if ($isCanceled) { - return; - } - - // If we have response or error from concurrent coroutine, we already have latest logs - if ($response === null && $err === null) { - $build = $dbForProject->getDocument('builds', $build->getId()); - - if ($build->isEmpty()) { - throw new \Exception('Build not found'); - } - - if ($build->getAttribute('status') === 'canceled') { - $isCanceled = true; - Console::info('Ignoring realtime logs because build has been canceled'); - return; - } - - $logs = \mb_substr($logs, 0, null, 'UTF-8'); // Get only valid UTF8 part - removes leftover half-multibytes causing SQL errors - - $build = $build->setAttribute('logs', $build->getAttribute('logs', '') . $logs); - $build = $dbForProject->updateDocument('builds', $build->getId(), $build); - - /** - * Trigger Realtime Event - */ - $queueForRealtime - ->setProject($project) - ->setSubscribers(['console']) - ->setEvent($event) - ->setParam('functionId', $function->getId()) - ->setParam('deploymentId', $deployment->getId()) - ->setPayload($build->getArrayCopy()) - ->trigger(); - } - } - ); - } catch (\Throwable $error) { - if (empty($err)) { - $err = $error; - } - } - }), - ]); - - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { - Console::info('Build has been canceled'); - return; - } - - if ($err) { - throw $err; - } - - $endTime = DateTime::now(); - $durationEnd = \microtime(true); - - $buildSizeLimit = (int)System::getEnv('_APP_FUNCTIONS_BUILD_SIZE_LIMIT', '2000000000'); - if ($response['size'] > $buildSizeLimit) { - throw new \Exception('Build size should be less than ' . number_format($buildSizeLimit / 1048576, 2) . ' MBs.'); - } - - /** Update the build document */ - $build->setAttribute('startTime', DateTime::format((new \DateTime())->setTimestamp(floor($response['startTime'])))); - $build->setAttribute('endTime', $endTime); - $build->setAttribute('duration', \intval(\ceil($durationEnd - $durationStart))); - $build->setAttribute('status', 'ready'); - $build->setAttribute('path', $response['path']); - $build->setAttribute('size', $response['size']); - $build->setAttribute('logs', $response['output']); - - $build = $dbForProject->updateDocument('builds', $buildId, $build); - - if ($isVcsEnabled) { - $this->runGitAction('ready', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForPlatform); - } - - Console::success("Build id: $buildId created"); - - /** Set auto deploy */ - if ($deployment->getAttribute('activate') === true) { - $function->setAttribute('deploymentInternalId', $deployment->getInternalId()); - $function->setAttribute('deployment', $deployment->getId()); - $function->setAttribute('live', true); - $function = $dbForProject->updateDocument('functions', $function->getId(), $function); - } - - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { - Console::info('Build has been canceled'); - return; - } - - /** Update function schedule */ - - // Inform scheduler if function is still active - $schedule = $dbForPlatform->getDocument('schedules', $function->getAttribute('scheduleId')); - $schedule - ->setAttribute('resourceUpdatedAt', DateTime::now()) - ->setAttribute('schedule', $function->getAttribute('schedule')) - ->setAttribute('active', !empty($function->getAttribute('schedule')) && !empty($function->getAttribute('deployment'))); - Authorization::skip(fn () => $dbForPlatform->updateDocument('schedules', $schedule->getId(), $schedule)); - } catch (\Throwable $th) { - if ($dbForProject->getDocument('builds', $buildId)->getAttribute('status') === 'canceled') { - Console::info('Build has been canceled'); - return; - } - - $endTime = DateTime::now(); - $durationEnd = \microtime(true); - $build->setAttribute('endTime', $endTime); - $build->setAttribute('duration', \intval(\ceil($durationEnd - $durationStart))); - $build->setAttribute('status', 'failed'); - $build->setAttribute('logs', $th->getMessage()); - - $build = $dbForProject->updateDocument('builds', $buildId, $build); - - if ($isVcsEnabled) { - $this->runGitAction('failed', $github, $providerCommitHash, $owner, $repositoryName, $project, $function, $deployment->getId(), $dbForProject, $dbForPlatform); - } - } finally { - /** - * Trigger Realtime Event - */ - $queueForRealtime - ->setProject($project) - ->setSubscribers(['console']) - ->setEvent($event) - ->setParam('functionId', $function->getId()) - ->setParam('deploymentId', $deployment->getId()) - ->setPayload($build->getArrayCopy()) - ->trigger(); - - /** Trigger usage queue */ - if ($build->getAttribute('status') === 'ready') { - $queueForStatsUsage - ->addMetric(METRIC_BUILDS_SUCCESS, 1) // per project - ->addMetric(METRIC_BUILDS_COMPUTE_SUCCESS, (int)$build->getAttribute('duration', 0) * 1000) - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_SUCCESS), 1) // per function - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE_SUCCESS), (int)$build->getAttribute('duration', 0) * 1000); - } elseif ($build->getAttribute('status') === 'failed') { - $queueForStatsUsage - ->addMetric(METRIC_BUILDS_FAILED, 1) // per project - ->addMetric(METRIC_BUILDS_COMPUTE_FAILED, (int)$build->getAttribute('duration', 0) * 1000) - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_FAILED), 1) // per function - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE_FAILED), (int)$build->getAttribute('duration', 0) * 1000); - } - - $queueForStatsUsage - ->addMetric(METRIC_BUILDS, 1) // per project - ->addMetric(METRIC_BUILDS_STORAGE, $build->getAttribute('size', 0)) - ->addMetric(METRIC_BUILDS_COMPUTE, (int)$build->getAttribute('duration', 0) * 1000) - ->addMetric(METRIC_BUILDS_MB_SECONDS, (int)(($spec['memory'] ?? APP_FUNCTION_MEMORY_DEFAULT) * $build->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_FUNCTION_CPUS_DEFAULT))) - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS), 1) // per function - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_STORAGE), $build->getAttribute('size', 0)) - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE), (int)$build->getAttribute('duration', 0) * 1000) - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_BUILDS_MB_SECONDS), (int)(($spec['memory'] ?? APP_FUNCTION_MEMORY_DEFAULT) * $build->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_FUNCTION_CPUS_DEFAULT))) - ->setProject($project) - ->trigger(); - } - } - - /** - * @param string $status - * @param GitHub $github - * @param string $providerCommitHash - * @param string $owner - * @param string $repositoryName - * @param Document $project - * @param Document $function - * @param string $deploymentId - * @param Database $dbForProject - * @param Database $dbForPlatform - * @return void - * @throws Structure - * @throws \Utopia\Database\Exception - * @throws Authorization - * @throws Conflict - * @throws Restricted - */ - protected function runGitAction(string $status, GitHub $github, string $providerCommitHash, string $owner, string $repositoryName, Document $project, Document $function, string $deploymentId, Database $dbForProject, Database $dbForPlatform): void - { - if ($function->getAttribute('providerSilentMode', false) === true) { - return; - } - - $deployment = $dbForProject->getDocument('deployments', $deploymentId); - $commentId = $deployment->getAttribute('providerCommentId', ''); - - if (!empty($providerCommitHash)) { - $message = match ($status) { - 'ready' => 'Build succeeded.', - 'failed' => 'Build failed.', - 'processing' => 'Building...', - default => $status - }; - - $state = match ($status) { - 'ready' => 'success', - 'failed' => 'failure', - 'processing' => 'pending', - default => $status - }; - - $functionName = $function->getAttribute('name'); - $projectName = $project->getAttribute('name'); - - $name = "{$functionName} ({$projectName})"; - - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; - $hostname = System::getEnv('_APP_DOMAIN'); - $functionId = $function->getId(); - $projectId = $project->getId(); - $providerTargetUrl = $protocol . '://' . $hostname . "/console/project-$projectId/functions/function-$functionId"; - - $github->updateCommitStatus($repositoryName, $providerCommitHash, $owner, $state, $message, $providerTargetUrl, $name); - } - - if (!empty($commentId)) { - $retries = 0; - - while (true) { - $retries++; - - try { - $dbForPlatform->createDocument('vcsCommentLocks', new Document([ - '$id' => $commentId - ])); - break; - } catch (\Throwable $err) { - if ($retries >= 9) { - throw $err; - } - - \sleep(1); - } - } - - // Wrap in try/finally to ensure lock file gets deleted - try { - $comment = new Comment(); - $comment->parseComment($github->getComment($owner, $repositoryName, $commentId)); - $comment->addBuild($project, $function, $status, $deployment->getId(), ['type' => 'logs']); - $github->updateComment($owner, $repositoryName, $commentId, $comment->generateComment()); - } finally { - $dbForPlatform->deleteDocument('vcsCommentLocks', $commentId); - } - } - } -} diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 093e6fda5a..0c0229b88a 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -8,7 +8,7 @@ use Appwrite\Event\Func; use Appwrite\Event\Mail; use Appwrite\Event\Realtime; use Appwrite\Event\Webhook; -use Appwrite\Network\Validator\CNAME; +use Appwrite\Network\Validator\DNS; use Appwrite\Template\Template; use Appwrite\Utopia\Response\Model\Rule; use Exception; @@ -28,6 +28,8 @@ use Utopia\Logger\Log; use Utopia\Platform\Action; use Utopia\Queue\Message; use Utopia\System\System; +use Utopia\Validator\AnyOf; +use Utopia\Validator\IP; class Certificates extends Action { @@ -52,10 +54,8 @@ class Certificates extends Action ->inject('queueForRealtime') ->inject('log') ->inject('certificates') - ->callback( - fn (Message $message, Database $dbForPlatform, Mail $queueForMails, Event $queueForEvents, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, Log $log, CertificatesAdapter $certificates) => - $this->action($message, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates) - ); + ->inject('plan') + ->callback([$this, 'action']); } /** @@ -72,8 +72,18 @@ class Certificates extends Action * @throws Throwable * @throws \Utopia\Database\Exception */ - public function action(Message $message, Database $dbForPlatform, Mail $queueForMails, Event $queueForEvents, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, Log $log, CertificatesAdapter $certificates): void - { + public function action( + Message $message, + Database $dbForPlatform, + Mail $queueForMails, + Event $queueForEvents, + Webhook $queueForWebhooks, + Func $queueForFunctions, + Realtime $queueForRealtime, + Log $log, + CertificatesAdapter $certificates, + array $plan + ): void { $payload = $message->getPayload() ?? []; if (empty($payload)) { @@ -86,7 +96,7 @@ class Certificates extends Action $log->addTag('domain', $domain->get()); - $this->execute($domain, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $skipRenewCheck); + $this->execute($domain, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $skipRenewCheck, $plan); } /** @@ -98,12 +108,24 @@ class Certificates extends Action * @param Realtime $queueForRealtime * @param CertificatesAdapter $certificates * @param bool $skipRenewCheck + * @param array $plan * @return void * @throws Throwable * @throws \Utopia\Database\Exception */ - private function execute(Domain $domain, Database $dbForPlatform, Mail $queueForMails, Event $queueForEvents, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, Log $log, CertificatesAdapter $certificates, bool $skipRenewCheck = false): void - { + private function execute( + Domain $domain, + Database $dbForPlatform, + Mail $queueForMails, + Event $queueForEvents, + Webhook $queueForWebhooks, + Func $queueForFunctions, + Realtime $queueForRealtime, + Log $log, + CertificatesAdapter $certificates, + bool $skipRenewCheck = false, + array $plan = [] + ): void { /** * 1. Read arguments and validate domain * 2. Get main domain @@ -184,7 +206,7 @@ class Certificates extends Action $certificate->setAttribute('renewDate', DateTime::now()); // Send email to security email - $this->notifyError($domain->get(), $e->getMessage(), $attempts, $queueForMails); + $this->notifyError($domain->get(), $e->getMessage(), $attempts, $queueForMails, $plan); throw $e; } finally { @@ -212,8 +234,16 @@ class Certificates extends Action * @throws Conflict * @throws Structure */ - private function saveCertificateDocument(string $domain, Document $certificate, bool $success, Database $dbForPlatform, Event $queueForEvents, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime): void - { + private function saveCertificateDocument( + string $domain, + Document $certificate, + bool $success, + Database $dbForPlatform, + Event $queueForEvents, + Webhook $queueForWebhooks, + Func $queueForFunctions, + Realtime $queueForRealtime + ): void { // Check if update or insert required $certificateDocument = $dbForPlatform->findOne('certificates', [Query::equal('domain', [$domain])]); if (!$certificateDocument->isEmpty()) { @@ -266,22 +296,39 @@ class Certificates extends Action } if (!$isMainDomain) { - // TODO: Would be awesome to also support A/AAAA records here. Maybe dry run? - // Validate if domain target is properly configured - $target = new Domain(System::getEnv('_APP_DOMAIN_TARGET', '')); + $validationStart = \microtime(true); - if (!$target->isKnown() || $target->isTest()) { - throw new Exception('Unreachable CNAME target (' . $target->get() . '), please use a domain with a public suffix.'); + $validators = []; + $targetCNAME = new Domain(System::getEnv('_APP_DOMAIN_TARGET_CNAME', '')); + if (!$targetCNAME->isKnown() || $targetCNAME->isTest()) { + $validators[] = new DNS($targetCNAME->get(), DNS::RECORD_CNAME); + } + if ((new IP(IP::V4))->isValid(System::getEnv('_APP_DOMAIN_TARGET_A', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_A', ''), DNS::RECORD_A); + } + if ((new IP(IP::V6))->isValid(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''))) { + $validators[] = new DNS(System::getEnv('_APP_DOMAIN_TARGET_AAAA', ''), DNS::RECORD_AAAA); + } + + // Validate if domain target is properly configured + if (empty($validators)) { + throw new Exception('At least one of domain targets environment variable must be configured.'); } // Verify domain with DNS records - $validationStart = \microtime(true); - $validator = new CNAME($target->get()); + $validator = new AnyOf($validators, AnyOf::TYPE_STRING); if (!$validator->isValid($domain->get())) { $log->addExtra('dnsTiming', \strval(\microtime(true) - $validationStart)); $log->addTag('dnsDomain', $domain->get()); - $error = $validator->getLogs(); + $errors = []; + foreach ($validators as $validator) { + if (!empty($validator->getLogs())) { + $errors[] = $validator->getLogs(); + } + } + + $error = \implode("\n", $errors); $log->addExtra('dnsResponse', \is_array($error) ? \json_encode($error) : \strval($error)); throw new Exception('Failed to verify domain DNS records.'); @@ -299,10 +346,11 @@ class Certificates extends Action * @param string $errorMessage Verbose error message * @param int $attempt How many times it failed already * @param Mail $queueForMails + * @param array $plan * @return void * @throws Exception */ - private function notifyError(string $domain, string $errorMessage, int $attempt, Mail $queueForMails): void + private function notifyError(string $domain, string $errorMessage, int $attempt, Mail $queueForMails, array $plan): void { // Log error into console Console::warning('Cannot renew domain (' . $domain . ') on attempt no. ' . $attempt . ' certificate: ' . $errorMessage); @@ -314,6 +362,15 @@ class Certificates extends Action $template->setParam('{{domain}}', $domain); $template->setParam('{{error}}', \nl2br($errorMessage)); $template->setParam('{{attempts}}', $attempt); + + $template->setParam('{{logoUrl}}', $plan['logoUrl'] ?? APP_EMAIL_LOGO_URL); + $template->setParam('{{accentColor}}', $plan['accentColor'] ?? APP_EMAIL_ACCENT_COLOR); + $template->setParam('{{twitterUrl}}', $plan['twitterUrl'] ?? APP_SOCIAL_TWITTER); + $template->setParam('{{discordUrl}}', $plan['discordUrl'] ?? APP_SOCIAL_DISCORD); + $template->setParam('{{githubUrl}}', $plan['githubUrl'] ?? APP_SOCIAL_GITHUB_APPWRITE); + $template->setParam('{{termsUrl}}', $plan['termsUrl'] ?? APP_EMAIL_TERMS_URL); + $template->setParam('{{privacyUrl}}', $plan['privacyUrl'] ?? APP_EMAIL_PRIVACY_URL); + $body = $template->render(); $emailVariables = [ @@ -345,8 +402,16 @@ class Certificates extends Action * * @return void */ - private function updateDomainDocuments(string $certificateId, string $domain, bool $success, Database $dbForPlatform, Event $queueForEvents, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime): void - { + private function updateDomainDocuments( + string $certificateId, + string $domain, + bool $success, + Database $dbForPlatform, + Event $queueForEvents, + Webhook $queueForWebhooks, + Func $queueForFunctions, + Realtime $queueForRealtime + ): void { // TODO: @christyjacob remove once we migrate the rules in 1.7.x if (System::getEnv('_APP_RULES_FORMAT') === 'md5') { $rule = $dbForPlatform->getDocument('rules', md5($domain)); diff --git a/src/Appwrite/Platform/Workers/Databases.php b/src/Appwrite/Platform/Workers/Databases.php index 1b3311b756..b2691b420e 100644 --- a/src/Appwrite/Platform/Workers/Databases.php +++ b/src/Appwrite/Platform/Workers/Databases.php @@ -38,7 +38,7 @@ class Databases extends Action ->inject('dbForProject') ->inject('queueForRealtime') ->inject('log') - ->callback(fn (Message $message, Document $project, Database $dbForPlatform, Database $dbForProject, Realtime $queueForRealtime, Log $log) => $this->action($message, $project, $dbForPlatform, $dbForProject, $queueForRealtime, $log)); + ->callback([$this, 'action']); } /** @@ -98,8 +98,15 @@ class Databases extends Action * @throws \Exception * @throws \Throwable */ - private function createAttribute(Document $database, Document $collection, Document $attribute, Document $project, Database $dbForPlatform, Database $dbForProject, Realtime $queueForRealtime): void - { + private function createAttribute( + Document $database, + Document $collection, + Document $attribute, + Document $project, + Database $dbForPlatform, + Database $dbForProject, + Realtime $queueForRealtime + ): void { if ($collection->isEmpty()) { throw new Exception('Missing collection'); } diff --git a/src/Appwrite/Platform/Workers/Deletes.php b/src/Appwrite/Platform/Workers/Deletes.php index 6d796f3dda..12143b4106 100644 --- a/src/Appwrite/Platform/Workers/Deletes.php +++ b/src/Appwrite/Platform/Workers/Deletes.php @@ -24,6 +24,7 @@ use Utopia\Database\Exception\Conflict; use Utopia\Database\Exception\Restricted; use Utopia\Database\Exception\Structure; use Utopia\Database\Query; +use Utopia\Database\Validator\Authorization as ValidatorAuthorization; use Utopia\DSN\DSN; use Utopia\Logger\Log; use Utopia\Platform\Action; @@ -54,6 +55,7 @@ class Deletes extends Action ->inject('getLogsDB') ->inject('deviceForFiles') ->inject('deviceForFunctions') + ->inject('deviceForSites') ->inject('deviceForBuilds') ->inject('deviceForCache') ->inject('certificates') @@ -61,18 +63,30 @@ class Deletes extends Action ->inject('executionRetention') ->inject('auditRetention') ->inject('log') - ->callback( - fn ($message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $getLogsDB, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, Executor $executor, string $executionRetention, string $auditRetention, Log $log) => - $this->action($message, $project, $dbForPlatform, $getProjectDB, $getLogsDB, $deviceForFiles, $deviceForFunctions, $deviceForBuilds, $deviceForCache, $certificates, $executor, $executionRetention, $auditRetention, $log) - ); + ->callback([$this, 'action']); } /** * @throws Exception * @throws Throwable */ - public function action(Message $message, Document $project, Database $dbForPlatform, callable $getProjectDB, callable $getLogsDB, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, Executor $executor, string $executionRetention, string $auditRetention, Log $log): void - { + public function action( + Message $message, + Document $project, + Database $dbForPlatform, + callable $getProjectDB, + callable $getLogsDB, + Device $deviceForFiles, + Device $deviceForFunctions, + Device $deviceForSites, + Device $deviceForBuilds, + Device $deviceForCache, + CertificatesAdapter $certificates, + Executor $executor, + string $executionRetention, + string $auditRetention, + Log $log + ): void { $payload = $message->getPayload() ?? []; if (empty($payload)) { @@ -93,13 +107,16 @@ class Deletes extends Action case DELETE_TYPE_DOCUMENT: switch ($document->getCollection()) { case DELETE_TYPE_PROJECTS: - $this->deleteProject($dbForPlatform, $getProjectDB, $deviceForFiles, $deviceForFunctions, $deviceForBuilds, $deviceForCache, $certificates, $document); + $this->deleteProject($dbForPlatform, $getProjectDB, $deviceForFiles, $deviceForSites, $deviceForFunctions, $deviceForBuilds, $deviceForCache, $certificates, $document); + break; + case DELETE_TYPE_SITES: + $this->deleteSite($dbForPlatform, $getProjectDB, $deviceForSites, $deviceForBuilds, $deviceForFiles, $document, $certificates, $project); break; case DELETE_TYPE_FUNCTIONS: $this->deleteFunction($dbForPlatform, $getProjectDB, $deviceForFunctions, $deviceForBuilds, $certificates, $document, $project, $executor); break; case DELETE_TYPE_DEPLOYMENTS: - $this->deleteDeployment($getProjectDB, $deviceForFunctions, $deviceForBuilds, $document, $project, $executor); + $this->deleteDeployment($dbForPlatform, $getProjectDB, $deviceForFunctions, $deviceForSites, $deviceForBuilds, $deviceForFiles, $document, $certificates, $project, $executor); break; case DELETE_TYPE_USERS: $this->deleteUser($getProjectDB, $document, $project); @@ -455,11 +472,12 @@ class Deletes extends Action foreach ($projects as $project) { $deviceForFiles = getDevice(APP_STORAGE_UPLOADS . '/app-' . $project->getId()); + $deviceForSites = getDevice(APP_STORAGE_SITES . '/app-' . $project->getId()); $deviceForFunctions = getDevice(APP_STORAGE_FUNCTIONS . '/app-' . $project->getId()); $deviceForBuilds = getDevice(APP_STORAGE_BUILDS . '/app-' . $project->getId()); $deviceForCache = getDevice(APP_STORAGE_CACHE . '/app-' . $project->getId()); - $this->deleteProject($dbForPlatform, $getProjectDB, $deviceForFiles, $deviceForFunctions, $deviceForBuilds, $deviceForCache, $certificates, $project); + $this->deleteProject($dbForPlatform, $getProjectDB, $deviceForFiles, $deviceForSites, $deviceForFunctions, $deviceForBuilds, $deviceForCache, $certificates, $project); $dbForPlatform->deleteDocument('projects', $project->getId()); } } @@ -477,7 +495,7 @@ class Deletes extends Action * @throws Authorization * @throws DatabaseException */ - private function deleteProject(Database $dbForPlatform, callable $getProjectDB, Device $deviceForFiles, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, Document $document): void + private function deleteProject(Database $dbForPlatform, callable $getProjectDB, Device $deviceForFiles, Device $deviceForSites, Device $deviceForFunctions, Device $deviceForBuilds, Device $deviceForCache, CertificatesAdapter $certificates, Document $document): void { $projectInternalId = $document->getInternalId(); $projectId = $document->getId(); @@ -603,6 +621,7 @@ class Deletes extends Action // Delete all storage directories $deviceForFiles->delete($deviceForFiles->getRoot(), true); + $deviceForSites->delete($deviceForSites->getRoot(), true); $deviceForFunctions->delete($deviceForFunctions->getRoot(), true); $deviceForBuilds->delete($deviceForBuilds->getRoot(), true); $deviceForCache->delete($deviceForCache->getRoot(), true); @@ -737,6 +756,90 @@ class Deletes extends Action } } + /** + * @param callable $getProjectDB + * @param Device $deviceForSites + * @param Device $deviceForBuilds + * @param Document $document function document + * @param Document $project + * @return void + * @throws Exception + */ + private function deleteSite(Database $dbForPlatform, callable $getProjectDB, Device $deviceForSites, Device $deviceForBuilds, Device $deviceForFiles, Document $document, CertificatesAdapter $certificates, Document $project): void + { + $dbForProject = $getProjectDB($project); + $siteId = $document->getId(); + $siteInternalId = $document->getInternalId(); + + /** + * Delete rules for site + */ + Console::info("Deleting rules for site " . $siteId); + $this->deleteByGroup('rules', [ + Query::equal('type', ['deployment']), + Query::equal('deploymentResourceType', ['site']), + Query::equal('deploymentResourceInternalId', [$siteInternalId]), + Query::equal('projectInternalId', [$project->getInternalId()]) + ], $dbForPlatform, function (Document $document) use ($dbForPlatform, $certificates) { + $this->deleteRule($dbForPlatform, $document, $certificates); + }); + + /** + * Delete Variables + */ + Console::info("Deleting variables for site " . $siteId); + $this->deleteByGroup('variables', [ + Query::equal('resourceType', ['site']), + Query::equal('resourceInternalId', [$siteInternalId]) + ], $dbForProject); + + /** + * Delete Deployments + */ + Console::info("Deleting deployments for site " . $siteId); + $deploymentInternalIds = []; + $deploymentIds = []; + $this->deleteByGroup('deployments', [ + Query::equal('resourceInternalId', [$siteInternalId]), + Query::equal('resourceType', ['site']), + Query::orderAsc() + ], $dbForProject, function (Document $document) use ($project, $certificates, $deviceForSites, $deviceForBuilds, $deviceForFiles, $dbForPlatform, &$deploymentInternalIds) { + $deploymentInternalIds[] = $document->getInternalId(); + $deploymentIds[] = $document->getId(); + $this->deleteBuildFiles($deviceForBuilds, $document); + $this->deleteDeploymentFiles($deviceForSites, $document); + $this->deleteDeploymentScreenshots($deviceForFiles, $dbForPlatform, $document); + }); + + /** + * Delete Logs + */ + Console::info("Deleting logs for site " . $siteId); + $this->deleteByGroup('executions', [ + Query::select($this->selects), + Query::equal('resourceInternalId', [$siteInternalId]), + Query::equal('resourceType', ['sites']), + Query::orderAsc() + ], $dbForProject); + + /** + * Delete VCS Repositories and VCS Comments + */ + Console::info("Deleting VCS repositories and comments linked to site " . $siteId); + $this->deleteByGroup('repositories', [ + Query::equal('projectInternalId', [$project->getInternalId()]), + Query::equal('resourceInternalId', [$siteInternalId]), + Query::equal('resourceType', ['site']), + ], $dbForPlatform, function (Document $document) use ($dbForPlatform) { + $providerRepositoryId = $document->getAttribute('providerRepositoryId', ''); + $projectInternalId = $document->getAttribute('projectInternalId', ''); + $this->deleteByGroup('vcsComments', [ + Query::equal('providerRepositoryId', [$providerRepositoryId]), + Query::equal('projectInternalId', [$projectInternalId]), + ], $dbForPlatform); + }); + } + /** * @param callable $getProjectDB * @param Device $deviceForFunctions @@ -759,9 +862,10 @@ class Deletes extends Action */ Console::info("Deleting rules for function " . $functionId); $this->deleteByGroup('rules', [ + Query::equal('type', ['deployment']), + Query::equal('deploymentResourceType', ['function']), + Query::equal('deploymentResourceInternalId', [$functionInternalId]), Query::equal('projectInternalId', [$project->getInternalId()]), - Query::equal('resourceInternalId', [$functionInternalId]), - Query::equal('resourceType', ['function']), Query::orderAsc() ], $dbForPlatform, function (Document $document) use ($project, $dbForPlatform, $certificates) { $this->deleteRule($dbForPlatform, $document, $certificates); @@ -785,33 +889,22 @@ class Deletes extends Action $deploymentInternalIds = []; $this->deleteByGroup('deployments', [ Query::equal('resourceInternalId', [$functionInternalId]), + Query::equal('resourceType', ['function']), Query::orderAsc() - ], $dbForProject, function (Document $document) use ($deviceForFunctions, &$deploymentInternalIds) { + ], $dbForProject, function (Document $document) use ($dbForPlatform, $project, $certificates, $deviceForFunctions, $deviceForBuilds, &$deploymentInternalIds) { $deploymentInternalIds[] = $document->getInternalId(); $this->deleteDeploymentFiles($deviceForFunctions, $document); + $this->deleteBuildFiles($deviceForBuilds, $document); }); - /** - * Delete builds - */ - Console::info("Deleting builds for function " . $functionId); - - foreach ($deploymentInternalIds as $deploymentInternalId) { - $this->deleteByGroup('builds', [ - Query::equal('deploymentInternalId', [$deploymentInternalId]), - Query::orderAsc() - ], $dbForProject, function (Document $document) use ($deviceForBuilds) { - $this->deleteBuildFiles($deviceForBuilds, $document); - }); - } - /** * Delete Executions */ Console::info("Deleting executions for function " . $functionId); $this->deleteByGroup('executions', [ Query::select($this->selects), - Query::equal('functionInternalId', [$functionInternalId]), + Query::equal('resourceInternalId', [$functionInternalId]), + Query::equal('resourceType', ['functions']), Query::orderAsc() ], $dbForProject); @@ -842,6 +935,53 @@ class Deletes extends Action $this->deleteRuntimes($getProjectDB, $document, $project, $executor); } + private function deleteDeploymentScreenshots(Device $deviceForFiles, Database $dbForPlatform, Document $deployment): void + { + $screenshotIds = []; + if (!empty($deployment->getAttribute('screenshotLight', ''))) { + $screenshotIds[] = $deployment->getAttribute('screenshotLight', ''); + } + if (!empty($deployment->getAttribute('screenshotDark', ''))) { + $screenshotIds[] = $deployment->getAttribute('screenshotDark', ''); + } + + if (empty($screenshotIds)) { + return; + } + Console::info("Deleting screenshots for deployment " . $deployment->getId()); + + $bucket = ValidatorAuthorization::skip(fn () => $dbForPlatform->getDocument('buckets', 'screenshots')); + if ($bucket->isEmpty()) { + Console::error('Failed to get bucket for deployment screenshots'); + return; + } + + foreach ($screenshotIds as $id) { + $file = ValidatorAuthorization::skip(fn () => $dbForPlatform->getDocument('bucket_' . $bucket->getInternalId(), $id)); + + if ($file->isEmpty()) { + Console::error('Failed to get deployment screenshot: ' . $id); + continue; + } + + $path = $file->getAttribute('path', ''); + + try { + if ($deviceForFiles->delete($path, true)) { + Console::success('Deleted deployment screenshot: ' . $path); + } else { + Console::error('Failed to delete deployment screenshot: ' . $path); + } + } catch (\Throwable $th) { + Console::error('Failed to delete deployment screenshot: ' . $path); + Console::error('[Error] Type: ' . get_class($th)); + Console::error('[Error] Message: ' . $th->getMessage()); + Console::error('[Error] File: ' . $th->getFile()); + Console::error('[Error] Line: ' . $th->getLine()); + } + } + } + /** * @param Device $device * @param Document $deployment @@ -850,7 +990,7 @@ class Deletes extends Action private function deleteDeploymentFiles(Device $device, Document $deployment): void { $deploymentId = $deployment->getId(); - $deploymentPath = $deployment->getAttribute('path', ''); + $deploymentPath = $deployment->getAttribute('sourcePath', ''); if (empty($deploymentPath)) { Console::info("No deployment files for deployment " . $deploymentId); @@ -879,13 +1019,13 @@ class Deletes extends Action * @param Document $build * @return void */ - private function deleteBuildFiles(Device $device, Document $build): void + private function deleteBuildFiles(Device $device, Document $deployment): void { - $buildId = $build->getId(); - $buildPath = $build->getAttribute('path', ''); + $deploymentId = $deployment->getId(); + $buildPath = $deployment->getAttribute('buildPath', ''); if (empty($buildPath)) { - Console::info("No build files for build " . $buildId); + Console::info("No build files for deployment " . $deploymentId); return; } @@ -907,6 +1047,7 @@ class Deletes extends Action /** * @param callable $getProjectDB * @param Device $deviceForFunctions + * @param Device $deviceForSites * @param Device $deviceForBuilds * @param Document $document * @param Document $project @@ -914,7 +1055,7 @@ class Deletes extends Action * @return void * @throws Exception */ - private function deleteDeployment(callable $getProjectDB, Device $deviceForFunctions, Device $deviceForBuilds, Document $document, Document $project, Executor $executor): void + private function deleteDeployment(Database $dbForPlatform, callable $getProjectDB, Device $deviceForFunctions, Device $deviceForSites, Device $deviceForBuilds, Device $deviceForFiles, Document $document, CertificatesAdapter $certificates, Document $project, Executor $executor): void { $projectId = $project->getId(); $dbForProject = $getProjectDB($project); @@ -924,18 +1065,33 @@ class Deletes extends Action /** * Delete deployment files */ - $this->deleteDeploymentFiles($deviceForFunctions, $document); + match ($document->getAttribute('resourceType')) { + 'functions' => $this->deleteDeploymentFiles($deviceForFunctions, $document), + 'sites' => $this->deleteDeploymentFiles($deviceForSites, $document), + default => throw new Exception('Invalid resource type') + }; /** - * Delete builds + * Delete deployment screenshots */ - Console::info("Deleting builds for deployment " . $deploymentId); + $this->deleteDeploymentScreenshots($deviceForFiles, $dbForPlatform, $document); - $this->deleteByGroup('builds', [ + /** + * Delete deployment build + */ + $this->deleteBuildFiles($deviceForBuilds, $document); + + /** + * Delete rules associated with the deployment + */ + Console::info("Deleting rules for deployment " . $deploymentId); + $this->deleteByGroup('rules', [ + Query::equal('trigger', ['deployment']), + Query::equal('type', ['deployment']), Query::equal('deploymentInternalId', [$deploymentInternalId]), - Query::orderAsc() - ], $dbForProject, function (Document $document) use ($deviceForBuilds) { - $this->deleteBuildFiles($deviceForBuilds, $document); + Query::equal('projectInternalId', [$project->getInternalId()]) + ], $dbForPlatform, function (Document $document) use ($dbForPlatform, $certificates) { + $this->deleteRule($dbForPlatform, $document, $certificates); }); /** diff --git a/src/Appwrite/Platform/Workers/Functions.php b/src/Appwrite/Platform/Workers/Functions.php index 4e1794c085..c8c68a58ba 100644 --- a/src/Appwrite/Platform/Workers/Functions.php +++ b/src/Appwrite/Platform/Workers/Functions.php @@ -53,11 +53,22 @@ class Functions extends Action ->inject('log') ->inject('executor') ->inject('isResourceBlocked') - ->callback(fn (Document $project, Message $message, Database $dbForProject, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, Event $queueForEvents, StatsUsage $queueForStatsUsage, Log $log, Executor $executor, callable $isResourceBlocked) => $this->action($project, $message, $dbForProject, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $queueForEvents, $queueForStatsUsage, $log, $executor, $isResourceBlocked)); + ->callback([$this, 'action']); } - public function action(Document $project, Message $message, Database $dbForProject, Webhook $queueForWebhooks, Func $queueForFunctions, Realtime $queueForRealtime, Event $queueForEvents, StatsUsage $queueForStatsUsage, Log $log, Executor $executor, callable $isResourceBlocked): void - { + public function action( + Document $project, + Message $message, + Database $dbForProject, + Webhook $queueForWebhooks, + Func $queueForFunctions, + Realtime $queueForRealtime, + Event $queueForEvents, + StatsUsage $queueForStatsUsage, + Log $log, + Executor $executor, + callable $isResourceBlocked + ): void { $payload = $message->getPayload() ?? []; if (empty($payload)) { @@ -269,8 +280,9 @@ class Functions extends Action $execution = new Document([ '$id' => $executionId, '$permissions' => $user->isEmpty() ? [] : [Permission::read(Role::user($user->getId()))], - 'functionInternalId' => $function->getInternalId(), - 'functionId' => $function->getId(), + 'resourceInternalId' => $function->getInternalId(), + 'resourceId' => $function->getId(), + 'resourceType' => 'functions', 'deploymentInternalId' => '', 'deploymentId' => '', 'trigger' => $trigger, @@ -283,7 +295,6 @@ class Functions extends Action 'errors' => $message, 'logs' => '', 'duration' => 0.0, - 'search' => implode(' ', [$function->getId(), $executionId]), ]); $execution = $dbForProject->createDocument('executions', $execution); @@ -343,8 +354,8 @@ class Functions extends Action ): void { $user ??= new Document(); $functionId = $function->getId(); - $deploymentId = $function->getAttribute('deployment', ''); - $spec = Config::getParam('runtime-specifications')[$function->getAttribute('specification', APP_FUNCTION_SPECIFICATION_DEFAULT)]; + $deploymentId = $function->getAttribute('deploymentId', ''); + $spec = Config::getParam('specifications')[$function->getAttribute('specification', APP_COMPUTE_SPECIFICATION_DEFAULT)]; $log->addTag('deploymentId', $deploymentId); @@ -363,19 +374,7 @@ class Functions extends Action return; } - $buildId = $deployment->getAttribute('buildId', ''); - - $log->addTag('buildId', $buildId); - - /** Check if build has exists */ - $build = $dbForProject->getDocument('builds', $buildId); - if ($build->isEmpty()) { - $errorMessage = 'The execution could not be completed because a corresponding deployment was not found. A function deployment needs to be created before it can be executed. Please create a deployment for your function and try again.'; - $this->fail($errorMessage, $dbForProject, $function, $trigger, $path, $method, $user, $jwt, $event); - return; - } - - if ($build->getAttribute('status') !== 'ready') { + if ($deployment->getAttribute('status') !== 'ready') { $errorMessage = 'The execution could not be completed because the build is not ready. Please wait for the build to complete and try again.'; $this->fail($errorMessage, $dbForProject, $function, $trigger, $path, $method, $user, $jwt, $event); return; @@ -421,8 +420,9 @@ class Functions extends Action $execution = new Document([ '$id' => $executionId, '$permissions' => $user->isEmpty() ? [] : [Permission::read(Role::user($user->getId()))], - 'functionInternalId' => $function->getInternalId(), - 'functionId' => $function->getId(), + 'resourceInternalId' => $function->getInternalId(), + 'resourceId' => $function->getId(), + 'resourceType' => 'functions', 'deploymentInternalId' => $deployment->getInternalId(), 'deploymentId' => $deployment->getId(), 'trigger' => $trigger, @@ -435,7 +435,6 @@ class Functions extends Action 'errors' => '', 'logs' => '', 'duration' => 0.0, - 'search' => implode(' ', [$functionId, $executionId]), ]); $execution = $dbForProject->createDocument('executions', $execution); @@ -497,8 +496,8 @@ class Functions extends Action 'APPWRITE_FUNCTION_PROJECT_ID' => $project->getId(), 'APPWRITE_FUNCTION_RUNTIME_NAME' => $runtime['name'] ?? '', 'APPWRITE_FUNCTION_RUNTIME_VERSION' => $runtime['version'] ?? '', - 'APPWRITE_FUNCTION_CPUS' => ($spec['cpus'] ?? APP_FUNCTION_CPUS_DEFAULT), - 'APPWRITE_FUNCTION_MEMORY' => ($spec['memory'] ?? APP_FUNCTION_MEMORY_DEFAULT), + 'APPWRITE_FUNCTION_CPUS' => ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT), + 'APPWRITE_FUNCTION_MEMORY' => ($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT), 'APPWRITE_VERSION' => APP_VERSION_STABLE, 'APPWRITE_REGION' => $project->getAttribute('region'), 'APPWRITE_DEPLOYMENT_TYPE' => $deployment->getAttribute('type', ''), @@ -528,15 +527,15 @@ class Functions extends Action variables: $vars, timeout: $function->getAttribute('timeout', 0), image: $runtime['image'], - source: $build->getAttribute('path', ''), + source: $deployment->getAttribute('buildPath', ''), entrypoint: $deployment->getAttribute('entrypoint', ''), version: $version, path: $path, method: $method, headers: $headers, runtimeEntrypoint: $command, - cpus: $spec['cpus'] ?? APP_FUNCTION_CPUS_DEFAULT, - memory: $spec['memory'] ?? APP_FUNCTION_MEMORY_DEFAULT, + cpus: $spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT, + memory: $spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT, logging: $function->getAttribute('logging', true), ); @@ -572,11 +571,14 @@ class Functions extends Action $queueForStatsUsage ->setProject($project) ->addMetric(METRIC_EXECUTIONS, 1) - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS), 1) + ->addMetric(str_replace(['{resourceType}'], [RESOURCE_TYPE_FUNCTIONS], METRIC_RESOURCE_TYPE_EXECUTIONS), 1) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS), 1) ->addMetric(METRIC_EXECUTIONS_COMPUTE, (int)($execution->getAttribute('duration') * 1000))// per project - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) - ->addMetric(METRIC_EXECUTIONS_MB_SECONDS, (int)(($spec['memory'] ?? APP_FUNCTION_MEMORY_DEFAULT) * $execution->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_FUNCTION_CPUS_DEFAULT))) - ->addMetric(str_replace('{functionInternalId}', $function->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_MB_SECONDS), (int)(($spec['memory'] ?? APP_FUNCTION_MEMORY_DEFAULT) * $execution->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_FUNCTION_CPUS_DEFAULT))) + ->addMetric(str_replace(['{resourceType}'], [RESOURCE_TYPE_FUNCTIONS], METRIC_RESOURCE_TYPE_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_COMPUTE), (int)($execution->getAttribute('duration') * 1000)) + ->addMetric(METRIC_EXECUTIONS_MB_SECONDS, (int)(($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT) * $execution->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT))) + ->addMetric(str_replace(['{resourceType}'], [RESOURCE_TYPE_FUNCTIONS], METRIC_RESOURCE_TYPE_EXECUTIONS_MB_SECONDS), (int)(($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT) * $execution->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT))) + ->addMetric(str_replace(['{resourceType}', '{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS, $function->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_MB_SECONDS), (int)(($spec['memory'] ?? APP_COMPUTE_MEMORY_DEFAULT) * $execution->getAttribute('duration', 0) * ($spec['cpus'] ?? APP_COMPUTE_CPUS_DEFAULT))) ->trigger() ; } @@ -584,13 +586,16 @@ class Functions extends Action $execution = $dbForProject->updateDocument('executions', $executionId, $execution); $executionModel = new Execution(); + $realtimeExecution = $executionModel->filter(new Document($execution->getArrayCopy())); + $realtimeExecution = $realtimeExecution->getArrayCopy(\array_keys($executionModel->getRules())); + $queueForEvents ->setProject($project) ->setUser($user) ->setEvent('functions.[functionId].executions.[executionId].update') ->setParam('functionId', $function->getId()) ->setParam('executionId', $execution->getId()) - ->setPayload($execution->getArrayCopy(array_keys($executionModel->getRules()))); + ->setPayload($realtimeExecution); /** Trigger Webhook */ $queueForWebhooks @@ -604,8 +609,8 @@ class Functions extends Action /** Trigger Realtime Events */ $queueForRealtime - ->from($queueForEvents) ->setSubscribers(['console', $project->getId()]) + ->from($queueForEvents) ->trigger(); if (!empty($error)) { diff --git a/src/Appwrite/Platform/Workers/Mails.php b/src/Appwrite/Platform/Workers/Mails.php index e48f96ea90..3a15182e51 100644 --- a/src/Appwrite/Platform/Workers/Mails.php +++ b/src/Appwrite/Platform/Workers/Mails.php @@ -29,7 +29,7 @@ class Mails extends Action ->inject('message') ->inject('register') ->inject('log') - ->callback(fn (Message $message, Registry $register, Log $log) => $this->action($message, $register, $log)); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index c9eca2a1e0..8491e91a6c 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -72,7 +72,7 @@ class Messaging extends Action ->inject('dbForProject') ->inject('deviceForFiles') ->inject('queueForStatsUsage') - ->callback(fn (Message $message, Document $project, Log $log, Database $dbForProject, Device $deviceForFiles, StatsUsage $queueForStatsUsage) => $this->action($message, $project, $log, $dbForProject, $deviceForFiles, $queueForStatsUsage)); + ->callback([$this, 'action']); } /** diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index d342875369..b746365f20 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -18,12 +18,14 @@ use Utopia\Migration\Destinations\Appwrite as DestinationAppwrite; use Utopia\Migration\Exception as MigrationException; use Utopia\Migration\Source; use Utopia\Migration\Sources\Appwrite as SourceAppwrite; +use Utopia\Migration\Sources\CSV; use Utopia\Migration\Sources\Firebase; use Utopia\Migration\Sources\NHost; use Utopia\Migration\Sources\Supabase; use Utopia\Migration\Transfer; use Utopia\Platform\Action; use Utopia\Queue\Message; +use Utopia\Storage\Device; use Utopia\System\System; class Migrations extends Action @@ -32,6 +34,8 @@ class Migrations extends Action protected Database $dbForPlatform; + protected Device $deviceForImports; + protected Document $project; /** @@ -64,15 +68,17 @@ class Migrations extends Action ->inject('dbForPlatform') ->inject('logError') ->inject('queueForRealtime') - ->callback(fn (Message $message, Document $project, Database $dbForProject, Database $dbForPlatform, callable $logError, Realtime $queueForRealtime) => $this->action($message, $project, $dbForProject, $dbForPlatform, $logError, $queueForRealtime)); + ->inject('deviceForImports') + ->callback([$this, 'action']); } /** * @throws Exception */ - public function action(Message $message, Document $project, Database $dbForProject, Database $dbForPlatform, callable $logError, Realtime $queueForRealtime): void + public function action(Message $message, Document $project, Database $dbForProject, Database $dbForPlatform, callable $logError, Realtime $queueForRealtime, Device $deviceForImports): void { $payload = $message->getPayload() ?? []; + $this->deviceForImports = $deviceForImports; if (empty($payload)) { throw new Exception('Missing payload'); @@ -106,7 +112,9 @@ class Migrations extends Action protected function processSource(Document $migration): Source { $source = $migration->getAttribute('source'); + $resourceId = $migration->getAttribute('resourceId'); $credentials = $migration->getAttribute('credentials'); + $migrationOptions = $migration->getAttribute('options'); $migrationSource = match ($source) { Firebase::getName() => new Firebase( @@ -135,6 +143,12 @@ class Migrations extends Action $credentials['endpoint'] === 'http://localhost/v1' ? 'http://appwrite/v1' : $credentials['endpoint'], $credentials['apiKey'], ), + CSV::getName() => new CSV( + $resourceId, + $migrationOptions['path'], + $this->deviceForImports, + $this->dbForProject + ), default => throw new \Exception('Invalid source type'), }; @@ -213,7 +227,10 @@ class Migrations extends Action 'databases.read', 'collections.read', 'documents.read', - ], + 'documents.write', + 'tokens.read', + 'tokens.write', + ] ]); return API_KEY_DYNAMIC . '_' . $apiKey; diff --git a/src/Appwrite/Platform/Workers/StatsResources.php b/src/Appwrite/Platform/Workers/StatsResources.php index 0144020d38..19d1223d95 100644 --- a/src/Appwrite/Platform/Workers/StatsResources.php +++ b/src/Appwrite/Platform/Workers/StatsResources.php @@ -198,7 +198,7 @@ class StatsResources extends Action } try { - $this->countForFunctions($dbForProject, $dbForLogs, $region); + $this->countForSitesAndFunctions($dbForProject, $region); } catch (Throwable $th) { call_user_func_array($this->logError, [$th, "StatsResources", "count_for_functions_{$project->getId()}"]); } @@ -302,21 +302,41 @@ class StatsResources extends Action return [$databaseDocuments, $databaseStorage]; } - protected function countForFunctions(Database $dbForProject, Database $dbForLogs, string $region) + protected function countForSitesAndFunctions(Database $dbForProject, string $region): void { - $deploymentsStorage = $dbForProject->sum('deployments', 'size'); - $buildsStorage = $dbForProject->sum('builds', 'size'); + $deploymentsStorage = $dbForProject->sum('deployments', 'sourceSize'); + $buildsStorage = $dbForProject->sum('deployments', 'buildSize'); $this->createStatsDocuments($region, METRIC_DEPLOYMENTS_STORAGE, $deploymentsStorage); $this->createStatsDocuments($region, METRIC_BUILDS_STORAGE, $buildsStorage); $deployments = $dbForProject->count('deployments'); - $builds = $dbForProject->count('builds'); $this->createStatsDocuments($region, METRIC_DEPLOYMENTS, $deployments); - $this->createStatsDocuments($region, METRIC_BUILDS, $builds); + $this->createStatsDocuments($region, METRIC_BUILDS, $deployments); + $this->countForFunctions($dbForProject, $region); + $this->countForSites($dbForProject, $region); + } - $this->foreachDocument($dbForProject, 'functions', [], function (Document $function) use ($dbForProject, $dbForLogs, $region) { - $functionDeploymentsStorage = $dbForProject->sum('deployments', 'size', [ + protected function countForFunctions(Database $dbForProject, string $region) + { + + $deploymentsStorage = $dbForProject->sum('deployments', 'sourceSize', [ + Query::equal('resourceType', [RESOURCE_TYPE_FUNCTIONS]) + ]); + $buildsStorage = $dbForProject->sum('deployments', 'buildSize', [ + Query::equal('resourceType', [RESOURCE_TYPE_FUNCTIONS]) + ]); + $this->createStatsDocuments($region, str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_DEPLOYMENTS_STORAGE), $deploymentsStorage); + $this->createStatsDocuments($region, str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_BUILDS_STORAGE), $buildsStorage); + + $deployments = $dbForProject->count('deployments', [ + Query::equal('resourceType', [RESOURCE_TYPE_FUNCTIONS]) + ]); + $this->createStatsDocuments($region, str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_DEPLOYMENTS), $deployments); + $this->createStatsDocuments($region, str_replace("{resourceType}", RESOURCE_TYPE_FUNCTIONS, METRIC_RESOURCE_TYPE_BUILDS), $deployments); + + $this->foreachDocument($dbForProject, 'functions', [], function (Document $function) use ($dbForProject, $region) { + $functionDeploymentsStorage = $dbForProject->sum('deployments', 'sourceSize', [ Query::equal('resourceInternalId', [$function->getInternalId()]), Query::equal('resourceType', [RESOURCE_TYPE_FUNCTIONS]), ]); @@ -339,15 +359,60 @@ class StatsResources extends Action $this->foreachDocument($dbForProject, 'deployments', [ Query::equal('resourceInternalId', [$function->getInternalId()]), Query::equal('resourceType', [RESOURCE_TYPE_FUNCTIONS]), - ], function (Document $deployment) use ($dbForProject, &$functionBuildsStorage): void { - $build = $dbForProject->getDocument('builds', $deployment->getAttribute('buildId', '')); - $functionBuildsStorage += $build->getAttribute('size', 0); + ], function (Document $deployment) use (&$functionBuildsStorage): void { + $functionBuildsStorage += $deployment->getAttribute('buildSize', 0); }); $this->createStatsDocuments($region, str_replace(['{resourceType}','{resourceInternalId}'], [RESOURCE_TYPE_FUNCTIONS,$function->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_STORAGE), $functionBuildsStorage); }); } + protected function countForSites(Database $dbForProject, string $region) + { + + $deploymentsStorage = $dbForProject->sum('deployments', 'sourceSize', [ + Query::equal('resourceType', [RESOURCE_TYPE_SITES]) + ]); + $buildsStorage = $dbForProject->sum('deployments', 'buildSize', [ + Query::equal('resourceType', [RESOURCE_TYPE_SITES]) + ]); + $this->createStatsDocuments($region, str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_DEPLOYMENTS_STORAGE), $deploymentsStorage); + $this->createStatsDocuments($region, str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_BUILDS_STORAGE), $buildsStorage); + + $deployments = $dbForProject->count('deployments', [ + Query::equal('resourceType', [RESOURCE_TYPE_SITES]) + ]); + $this->createStatsDocuments($region, str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_DEPLOYMENTS), $deployments); + $this->createStatsDocuments($region, str_replace("{resourceType}", RESOURCE_TYPE_SITES, METRIC_RESOURCE_TYPE_BUILDS), $deployments); + + $this->foreachDocument($dbForProject, 'sites', [], function (Document $site) use ($dbForProject, $region) { + $siteDeploymentsStorage = $dbForProject->sum('deployments', 'sourceSize', [ + Query::equal('resourceInternalId', [$site->getInternalId()]), + Query::equal('resourceType', [RESOURCE_TYPE_SITES]), + ]); + $this->createStatsDocuments($region, str_replace(['{resourceType}','{resourceInternalId}'], [RESOURCE_TYPE_SITES,$site->getInternalId()], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS_STORAGE), $siteDeploymentsStorage); + + $siteDeployments = $dbForProject->count('deployments', [ + Query::equal('resourceInternalId', [$site->getInternalId()]), + Query::equal('resourceType', [RESOURCE_TYPE_SITES]), + ]); + $this->createStatsDocuments($region, str_replace(['{resourceType}','{resourceInternalId}'], [RESOURCE_TYPE_SITES,$site->getInternalId()], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS), $siteDeployments); + + /** + * As deployments and builds have 1-1 relationship, + * the count for one should match the other + */ + $this->createStatsDocuments($region, str_replace(['{resourceType}','{resourceInternalId}'], [RESOURCE_TYPE_SITES,$site->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS), $siteDeployments); + + $siteBuildsStorage = $dbForProject->sum('deployments', 'buildSize', [ + Query::equal('resourceInternalId', [$site->getInternalId()]), + Query::equal('resourceType', [RESOURCE_TYPE_SITES]), + ]); + + $this->createStatsDocuments($region, str_replace(['{resourceType}','{resourceInternalId}'], [RESOURCE_TYPE_SITES,$site->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_STORAGE), $siteBuildsStorage); + }); + } + protected function createStatsDocuments(string $region, string $metric, int $value) { foreach ($this->periods as $period => $format) { diff --git a/src/Appwrite/Platform/Workers/StatsUsage.php b/src/Appwrite/Platform/Workers/StatsUsage.php index 66f285fcf5..07131593e2 100644 --- a/src/Appwrite/Platform/Workers/StatsUsage.php +++ b/src/Appwrite/Platform/Workers/StatsUsage.php @@ -230,7 +230,11 @@ class StatsUsage extends Action case str_starts_with($document->getCollection(), 'database_') && !str_contains($document->getCollection(), 'collection'): //collections $parts = explode('_', $document->getCollection()); $databaseInternalId = $parts[1] ?? 0; - $documents = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{databaseInternalId}', '{collectionInternalId}'], [$databaseInternalId, $document->getInternalId()], METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS))); + $documents = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace( + ['{databaseInternalId}', '{collectionInternalId}'], + [$databaseInternalId, $document->getInternalId()], + METRIC_DATABASE_ID_COLLECTION_ID_DOCUMENTS + ))); if (!empty($documents['value'])) { $metrics[] = [ @@ -263,20 +267,24 @@ class StatsUsage extends Action } break; - case $document->getCollection() === 'functions': - $deployments = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{resourceType}', '{resourceInternalId}'], ['functions', $document->getInternalId()], METRIC_FUNCTION_ID_DEPLOYMENTS))); - $deploymentsStorage = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{resourceType}', '{resourceInternalId}'], ['functions', $document->getInternalId()], METRIC_FUNCTION_ID_DEPLOYMENTS_STORAGE))); - $builds = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace('{functionInternalId}', $document->getInternalId(), METRIC_FUNCTION_ID_BUILDS))); - $buildsStorage = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace('{functionInternalId}', $document->getInternalId(), METRIC_FUNCTION_ID_BUILDS_STORAGE))); - $buildsCompute = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace('{functionInternalId}', $document->getInternalId(), METRIC_FUNCTION_ID_BUILDS_COMPUTE))); - $executions = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace('{functionInternalId}', $document->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS))); - $executionsCompute = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace('{functionInternalId}', $document->getInternalId(), METRIC_FUNCTION_ID_EXECUTIONS_COMPUTE))); + case $document->getCollection() === 'functions' || $document->getCollection() === 'sites': + $deployments = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getCollection(), $document->getInternalId()], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS))); + $deploymentsStorage = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getCollection(), $document->getInternalId()], METRIC_RESOURCE_TYPE_ID_DEPLOYMENTS_STORAGE))); + $builds = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getCollection(), $document->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS))); + $buildsStorage = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getCollection(), $document->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_STORAGE))); + $buildsCompute = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getCollection(), $document->getInternalId()], METRIC_RESOURCE_TYPE_ID_BUILDS_COMPUTE))); + $executions = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getCollection(), $document->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS))); + $executionsCompute = $dbForProject->getDocument('stats', md5(self::INFINITY_PERIOD . str_replace(['{resourceType}', '{resourceInternalId}'], [$document->getCollection(), $document->getInternalId()], METRIC_RESOURCE_TYPE_ID_EXECUTIONS_COMPUTE))); if (!empty($deployments['value'])) { $metrics[] = [ 'key' => METRIC_DEPLOYMENTS, 'value' => ($deployments['value'] * -1), ]; + $metrics[] = [ + 'key' => str_replace("{resourceType}", $document->getCollection(), METRIC_RESOURCE_TYPE_DEPLOYMENTS), + 'value' => ($deployments['value'] * -1), + ]; } if (!empty($deploymentsStorage['value'])) { @@ -284,6 +292,10 @@ class StatsUsage extends Action 'key' => METRIC_DEPLOYMENTS_STORAGE, 'value' => ($deploymentsStorage['value'] * -1), ]; + $metrics[] = [ + 'key' => str_replace("{resourceType}", $document->getCollection(), METRIC_RESOURCE_TYPE_DEPLOYMENTS_STORAGE), + 'value' => ($deploymentsStorage['value'] * -1), + ]; } if (!empty($builds['value'])) { @@ -291,6 +303,10 @@ class StatsUsage extends Action 'key' => METRIC_BUILDS, 'value' => ($builds['value'] * -1), ]; + $metrics[] = [ + 'key' => str_replace("{resourceType}", $document->getCollection(), METRIC_RESOURCE_TYPE_BUILDS), + 'value' => ($builds['value'] * -1), + ]; } if (!empty($buildsStorage['value'])) { @@ -298,6 +314,10 @@ class StatsUsage extends Action 'key' => METRIC_BUILDS_STORAGE, 'value' => ($buildsStorage['value'] * -1), ]; + $metrics[] = [ + 'key' => str_replace("{resourceType}", $document->getCollection(), METRIC_RESOURCE_TYPE_BUILDS_STORAGE), + 'value' => ($buildsStorage['value'] * -1), + ]; } if (!empty($buildsCompute['value'])) { @@ -305,6 +325,10 @@ class StatsUsage extends Action 'key' => METRIC_BUILDS_COMPUTE, 'value' => ($buildsCompute['value'] * -1), ]; + $metrics[] = [ + 'key' => str_replace("{resourceType}", $document->getCollection(), METRIC_RESOURCE_TYPE_BUILDS_COMPUTE), + 'value' => ($buildsCompute['value'] * -1), + ]; } if (!empty($executions['value'])) { @@ -312,6 +336,10 @@ class StatsUsage extends Action 'key' => METRIC_EXECUTIONS, 'value' => ($executions['value'] * -1), ]; + $metrics[] = [ + 'key' => str_replace("{resourceType}", $document->getCollection(), METRIC_RESOURCE_TYPE_EXECUTIONS), + 'value' => ($executions['value'] * -1), + ]; } if (!empty($executionsCompute['value'])) { @@ -319,6 +347,10 @@ class StatsUsage extends Action 'key' => METRIC_EXECUTIONS_COMPUTE, 'value' => ($executionsCompute['value'] * -1), ]; + $metrics[] = [ + 'key' => str_replace("{resourceType}", $document->getCollection(), METRIC_RESOURCE_TYPE_EXECUTIONS_COMPUTE), + 'value' => ($executionsCompute['value'] * -1), + ]; } break; default: diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index 44e8bd3118..ada4d6faaa 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -37,7 +37,8 @@ class Webhooks extends Action ->inject('queueForMails') ->inject('queueForStatsUsage') ->inject('log') - ->callback(fn (Message $message, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage, Log $log) => $this->action($message, $project, $dbForPlatform, $queueForMails, $queueForStatsUsage, $log)); + ->inject('plan') + ->callback([$this, 'action']); } /** @@ -45,11 +46,13 @@ class Webhooks extends Action * @param Document $project * @param Database $dbForPlatform * @param Mail $queueForMails + * @param StatsUsage $queueForStatsUsage * @param Log $log + * @param array $plan * @return void * @throws Exception */ - public function action(Message $message, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage, Log $log): void + public function action(Message $message, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage, Log $log, array $plan): void { $this->errors = []; $payload = $message->getPayload() ?? []; @@ -68,7 +71,7 @@ class Webhooks extends Action foreach ($project->getAttribute('webhooks', []) as $webhook) { if (array_intersect($webhook->getAttribute('events', []), $events)) { - $this->execute($events, $webhookPayload, $webhook, $user, $project, $dbForPlatform, $queueForMails, $queueForStatsUsage); + $this->execute($events, $webhookPayload, $webhook, $user, $project, $dbForPlatform, $queueForMails, $queueForStatsUsage, $plan); } } @@ -85,9 +88,10 @@ class Webhooks extends Action * @param Document $project * @param Database $dbForPlatform * @param Mail $queueForMails + * @param array $plan * @return void */ - private function execute(array $events, string $payload, Document $webhook, Document $user, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage): void + private function execute(array $events, string $payload, Document $webhook, Document $user, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage, array $plan): void { if ($webhook->getAttribute('enabled') !== true) { return; @@ -163,7 +167,7 @@ class Webhooks extends Action if ($attempts >= \intval(System::getEnv('_APP_WEBHOOK_MAX_FAILED_ATTEMPTS', '10'))) { $webhook->setAttribute('enabled', false); - $this->sendEmailAlert($attempts, $statusCode, $webhook, $project, $dbForPlatform, $queueForMails); + $this->sendEmailAlert($attempts, $statusCode, $webhook, $project, $dbForPlatform, $queueForMails, $plan); } $dbForPlatform->updateDocument('webhooks', $webhook->getId(), $webhook); @@ -198,9 +202,10 @@ class Webhooks extends Action * @param Document $project * @param Database $dbForPlatform * @param Mail $queueForMails + * @param array $plan * @return void */ - public function sendEmailAlert(int $attempts, mixed $statusCode, Document $webhook, Document $project, Database $dbForPlatform, Mail $queueForMails): void + public function sendEmailAlert(int $attempts, mixed $statusCode, Document $webhook, Document $project, Database $dbForPlatform, Mail $queueForMails, array $plan): void { $memberships = $dbForPlatform->find('memberships', [ Query::equal('teamInternalId', [$project->getAttribute('teamInternalId')]), @@ -225,6 +230,14 @@ class Webhooks extends Action $template->setParam('{{path}}', "/console/project-$projectId/settings/webhooks/$webhookId"); $template->setParam('{{attempts}}', $attempts); + $template->setParam('{{logoUrl}}', $plan['logoUrl'] ?? APP_EMAIL_LOGO_URL); + $template->setParam('{{accentColor}}', $plan['accentColor'] ?? APP_EMAIL_ACCENT_COLOR); + $template->setParam('{{twitterUrl}}', $plan['twitterUrl'] ?? APP_SOCIAL_TWITTER); + $template->setParam('{{discordUrl}}', $plan['discordUrl'] ?? APP_SOCIAL_DISCORD); + $template->setParam('{{githubUrl}}', $plan['githubUrl'] ?? APP_SOCIAL_GITHUB_APPWRITE); + $template->setParam('{{termsUrl}}', $plan['termsUrl'] ?? APP_EMAIL_TERMS_URL); + $template->setParam('{{privacyUrl}}', $plan['privacyUrl'] ?? APP_EMAIL_PRIVACY_URL); + // TODO: Use setbodyTemplate once #7307 is merged $subject = 'Webhook deliveries have been paused'; $body = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-base-styled.tpl'); diff --git a/src/Appwrite/SDK/Method.php b/src/Appwrite/SDK/Method.php index c1ca7c148c..d0b08f154e 100644 --- a/src/Appwrite/SDK/Method.php +++ b/src/Appwrite/SDK/Method.php @@ -86,11 +86,13 @@ class Method return; } - $descPath = $this->getDescriptionFilePath(); + if (\str_ends_with($desc, '.md')) { + $descPath = $this->getDescriptionFilePath() ?: $this->getDescription(); - if (empty($descPath)) { - self::$errors[] = "Error with {$this->getRouteName()} method: Description file not found at {$desc}"; - return; + if (empty($descPath)) { + self::$errors[] = "Error with {$this->getRouteName()} method: Description file not found at {$desc}"; + return; + } } } diff --git a/src/Appwrite/SDK/Specification/Format.php b/src/Appwrite/SDK/Specification/Format.php index c9c0acc514..8dbccf5cbb 100644 --- a/src/Appwrite/SDK/Specification/Format.php +++ b/src/Appwrite/SDK/Specification/Format.php @@ -113,6 +113,18 @@ abstract class Format protected function getEnumName(string $service, string $method, string $param): ?string { switch ($service) { + case 'console': + switch ($method) { + case 'getResource': + switch ($param) { + case 'type': + return 'ConsoleResourceType'; + case 'value': + return 'ConsoleResourceValue'; + } + break; + } + break; case 'account': switch ($method) { case 'createOAuth2Session': @@ -184,7 +196,7 @@ abstract class Format case 'functions': switch ($method) { case 'getUsage': - case 'getFunctionUsage': + case 'listUsage': switch ($param) { case 'range': return 'FunctionUsageRange'; @@ -196,6 +208,52 @@ abstract class Format return 'ExecutionMethod'; } break; + case 'getDeploymentDownload': + switch ($param) { + case 'type': + return 'DeploymentDownloadType'; + } + break; + case 'createVcsDeployment': + switch ($param) { + case 'type': + return 'VCSDeploymentType'; + } + break; + } + break; + case 'sites': + switch ($method) { + case 'getDeploymentDownload': + switch ($param) { + case 'type': + return 'DeploymentDownloadType'; + } + break; + case 'getUsage': + case 'listUsage': + switch ($param) { + case 'range': + return 'SiteUsageRange'; + } + break; + case 'createVcsDeployment': + switch ($param) { + case 'type': + return 'VCSDeploymentType'; + } + break; + } + break; + case 'vcs': + switch ($method) { + case 'createRepositoryDetection': + case 'listRepositories': + switch ($param) { + case 'type': + return 'VCSDetectionType'; + } + break; } break; case 'messaging': @@ -380,10 +438,24 @@ abstract class Format return ['Twenty Four Hours', 'Thirty Days', 'Ninety Days']; } break; + case 'proxy': + switch ($method) { + case 'createRedirectRule': + return ['Moved Permanently 301', 'Found 302', 'Temporary Redirect 307', 'Permanent Redirect 308']; + } + break; case 'functions': switch ($method) { case 'getUsage': - case 'getFunctionUsage': + case 'listUsage': + // Range Enum Keys + return ['Twenty Four Hours', 'Thirty Days', 'Ninety Days']; + } + break; + case 'sites': + switch ($method) { + case 'getUsage': + case 'listUsage': // Range Enum Keys return ['Twenty Four Hours', 'Thirty Days', 'Ninety Days']; } diff --git a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php index 36c1e74c85..f486a61ce5 100644 --- a/src/Appwrite/SDK/Specification/Format/OpenAPI3.php +++ b/src/Appwrite/SDK/Specification/Format/OpenAPI3.php @@ -116,7 +116,7 @@ class OpenAPI3 extends Format $method = \array_keys($method)[0]; } - $desc = $sdk->getDescriptionFilePath(); + $desc = $sdk->getDescriptionFilePath() ?: $sdk->getDescription(); $produces = ($sdk->getContentType())->value; $routeSecurity = $sdk->getAuth() ?? []; $sdkPlatforms = []; @@ -143,11 +143,14 @@ class OpenAPI3 extends Format $namespace = $sdk->getNamespace() ?? 'default'; + $desc ??= ''; + $descContents = \str_ends_with($desc, '.md') ? \file_get_contents($desc) : $desc; + $temp = [ 'summary' => $route->getDesc(), 'operationId' => $namespace . ucfirst($method), 'tags' => [$namespace], - 'description' => ($desc) ? \file_get_contents($desc) : '', + 'description' => $descContents, 'responses' => [], 'x-appwrite' => [ // Appwrite related metadata 'method' => $method, @@ -175,6 +178,7 @@ class OpenAPI3 extends Format $desc = $method->getDescriptionFilePath(); $additionalMethod = [ 'name' => $method->getMethodName(), + 'auth' => \array_merge(...\array_map(fn ($auth) => [$auth->value => []], $method->getAuth())), 'parameters' => [], 'required' => [], 'responses' => [], diff --git a/src/Appwrite/SDK/Specification/Format/Swagger2.php b/src/Appwrite/SDK/Specification/Format/Swagger2.php index e5b7906b3f..948798ef0b 100644 --- a/src/Appwrite/SDK/Specification/Format/Swagger2.php +++ b/src/Appwrite/SDK/Specification/Format/Swagger2.php @@ -116,7 +116,7 @@ class Swagger2 extends Format $method = array_keys($method)[0]; } - $desc = $sdk->getDescriptionFilePath(); + $desc = $sdk->getDescriptionFilePath() ?: $sdk->getDescription(); $produces = ($sdk->getContentType())->value; $routeSecurity = $sdk->getAuth() ?? []; $sdkPlatforms = []; @@ -143,13 +143,16 @@ class Swagger2 extends Format $namespace = $sdk->getNamespace() ?? 'default'; + $desc ??= ''; + $descContents = \str_ends_with($desc, '.md') ? \file_get_contents($desc) : $desc; + $temp = [ 'summary' => $route->getDesc(), 'operationId' => $namespace . ucfirst($method), 'consumes' => [], 'produces' => [], 'tags' => [$namespace], - 'description' => ($desc) ? \file_get_contents($desc) : '', + 'description' => $descContents, 'responses' => [], 'x-appwrite' => [ // Appwrite related metadata 'method' => $method, @@ -181,6 +184,7 @@ class Swagger2 extends Format $additionalMethod = [ 'name' => $method->getMethodName(), + 'auth' => \array_merge(...\array_map(fn ($auth) => [$auth->value => []], $method->getAuth())), 'parameters' => [], 'required' => [], 'responses' => [], @@ -283,13 +287,13 @@ class Swagger2 extends Format $securities = ['Project' => []]; foreach ($sdk->getAuth() as $security) { - /** @var \Appwrite\SDK\AuthType $security */ - if (array_key_exists($security->value, $this->keys)) { + /** @var AuthType $security */ + if (\array_key_exists($security->value, $this->keys)) { $securities[$security->value] = []; } } - $temp['x-appwrite']['auth'] = array_slice($securities, 0, $this->authCount); + $temp['x-appwrite']['auth'] = \array_slice($securities, 0, $this->authCount); $temp['security'][] = $securities; } diff --git a/src/Appwrite/Transformation/Adapter.php b/src/Appwrite/Transformation/Adapter.php new file mode 100644 index 0000000000..b4b5dce8a8 --- /dev/null +++ b/src/Appwrite/Transformation/Adapter.php @@ -0,0 +1,32 @@ +<?php + +namespace Appwrite\Transformation; + +abstract class Adapter +{ + protected mixed $input; + protected mixed $output; + + public function __construct() + { + + } + + public function setInput(mixed $input): self + { + $this->input = $input; + return $this; + } + + public function getOutput(): mixed + { + return $this->output; + } + + /** + * @param array<mixed> $traits + */ + abstract public function isValid(array $traits): bool; + + abstract public function transform(): void; +} diff --git a/src/Appwrite/Transformation/Adapter/Mock.php b/src/Appwrite/Transformation/Adapter/Mock.php new file mode 100644 index 0000000000..13ec1cc88b --- /dev/null +++ b/src/Appwrite/Transformation/Adapter/Mock.php @@ -0,0 +1,26 @@ +<?php + +namespace Appwrite\Transformation\Adapter; + +use Appwrite\Transformation\Adapter; + +class Mock extends Adapter +{ + /** + * @param array<mixed> $traits Mock traits + */ + public function isValid(array $traits): bool + { + if ($traits['mock'] === true) { + return true; + } + + return false; + } + + public function transform(): void + { + $this->output = $this->input; + $this->output = "Mock: " . $this->output; + } +} diff --git a/src/Appwrite/Transformation/Adapter/Preview.php b/src/Appwrite/Transformation/Adapter/Preview.php new file mode 100644 index 0000000000..70af19a188 --- /dev/null +++ b/src/Appwrite/Transformation/Adapter/Preview.php @@ -0,0 +1,209 @@ +<?php + +namespace Appwrite\Transformation\Adapter; + +use Appwrite\Transformation\Adapter; + +class Preview extends Adapter +{ + /** + * @param array<mixed> $traits Proxied response headers + */ + public function isValid(array $traits): bool + { + $contentType = ''; + + foreach ($traits as $key => $value) { + if (\strtolower($key) === 'content-type') { + $contentType = $value; + break; + } + } + + if (\str_contains($contentType, 'text/html')) { + return true; + } + + return false; + } + + public function transform(): void + { + $this->output = $this->input; + + $banner = <<<EOT + <style> + @import url(https://fonts.bunny.net/css?family=fira-code:400|inter:400); + + #appwrite-preview { + min-width: auto; + min-height: auto; + max-width: none; + max-height: none; + width: auto; + height: auto; + padding: 0; + margin: 0; + position: fixed; + right: 16px; + bottom: 16px; + z-index: 1; + border-radius: var(--border-radius-S, 8px); + border: var(--border-width-S, 1px) solid var(--color-border-neutral, #EDEDF0); + background: var(--color-bgColor-neutral-primary, #FFF); + box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.03), 0px 4px 4px 0px rgba(0, 0, 0, 0.04); + padding: var(--space-3, 6px) var(--space-4, 8px); + display: flex; + justify-content: center; + align-items: center; + gap: var(--gap-XXS, 4px); + cursor: pointer; + transition: opacity 0.3s; + } + + #appwrite-preview-close { + position: absolute; + right: 0px; + bottom: 0px; + border-radius: var(--border-radius-S, 8px); + background: linear-gradient(270deg, #FFF 69.64%, rgba(255, 255, 255, 0.00) 114.29%); + height: 100%; + aspect-ratio: 1 / 1; + display: flex; + justify-content: center; + align-items: center; + opacity: 0; + transition: opacity 0.3s; + } + + #appwrite-preview-logo-dark { + display: none; + } + + #appwrite-preview:hover #appwrite-preview-close { + opacity: 1; + } + + #appwrite-preview-text { + padding: 0; + margin: 0; + color: var(--color-fgColor-neutral-secondary, #56565C); + font-family: var(--font-family-sansSerif, Inter), sans-serif; + font-size: var(--font-size-XS, 12px); + font-style: normal; + font-weight: 500; + line-height: 130%; + letter-spacing: -0.12px; + } + + #appwrite-preview-close-text { + opacity: 0; + transition: opacity 0.3s; + position: absolute; + bottom: calc(15px + 4px); + display: flex; + padding: var(--space-1, 2px) var(--space-2, 4px); + color: var(--color-fgColor-neutral-secondary, #56565C); + text-align: center; + font-family: var(--font-family-sansSerif, Inter), sans-serif; + font-size: var(--font-size-XS, 12px); + font-style: normal; + font-weight: 400; + line-height: 130%; + letter-spacing: -0.12px; + border-radius: var(--border-radius-XS, 6px); + background: #EDEDF0; + } + + #appwrite-preview-close:hover #appwrite-preview-close-text { + opacity: 1; + } + + @media (prefers-color-scheme: dark) { + #appwrite-preview { + border: var(--border-width-S, 1px) solid var(--color-border-neutral, #2D2D31); + background: var(--color-bgColor-neutral-primary, #1D1D21); + box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.03), 0px 4px 4px 0px rgba(0, 0, 0, 0.04); + } + + #appwrite-preview-text { + color: var(--color-fgColor-neutral-secondary, #C3C3C6); + font-family: var(--font-family-sansSerif, Inter), sans-serif; + font-size: var(--font-size-XS, 12px); + } + + #appwrite-preview-logo-dark { + display: block; + } + + #appwrite-preview-logo-light { + display: none; + } + + #appwrite-preview-close { + background: linear-gradient(270deg, #1D1D21 69.64%, rgba(29, 29, 33, 0.00) 114.29%); + } + + #appwrite-preview-close-text { + background: #2D2D31; + color: var(--color-fgColor-neutral-secondary, #C3C3C6); + } + } + </style> + + <button id="appwrite-preview"> + <p id="appwrite-preview-text">Preview by</p> + + <div id="appwrite-preview-close"> + <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path fill-rule="evenodd" clip-rule="evenodd" d="M3.43451 3.43439C3.74693 3.12197 4.25346 3.12197 4.56588 3.43439L8.0002 6.8687L11.4345 3.43439C11.7469 3.12197 12.2535 3.12197 12.5659 3.43439C12.8783 3.74681 12.8783 4.25334 12.5659 4.56576L9.13157 8.00007L12.5659 11.4344C12.8783 11.7468 12.8783 12.2533 12.5659 12.5658C12.2535 12.8782 11.7469 12.8782 11.4345 12.5658L8.0002 9.13144L4.56588 12.5658C4.25346 12.8782 3.74693 12.8782 3.43451 12.5658C3.12209 12.2533 3.12209 11.7468 3.43451 11.4344L6.86882 8.00007L3.43451 4.56576C3.12209 4.25334 3.12209 3.74681 3.43451 3.43439Z" fill="#97979B"/> + </svg> + + <p id="appwrite-preview-close-text">Hide</p> + </div> + + <svg id="appwrite-preview-logo-light" width="65" height="12" viewBox="0 0 65 12" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M18.9862 9.74762C20.0493 9.74762 20.5867 9.191 20.8204 8.81202H20.9255C20.9722 9.21468 21.2526 9.59366 21.8017 9.59366H22.8414V8.40936H22.5727C22.3858 8.40936 22.2924 8.30277 22.2924 8.13697V3.38795H20.9138V4.1459H20.8087C20.54 3.76692 19.9792 3.23399 18.9511 3.23399C17.3156 3.23399 16.1006 4.60777 16.1006 6.4908C16.1006 8.37383 17.3389 9.74762 18.9862 9.74762ZM19.2315 8.39752C18.2619 8.39752 17.5025 7.6751 17.5025 6.50265C17.5025 5.35388 18.2385 4.57224 19.2198 4.57224C20.1544 4.57224 20.9372 5.27098 20.9372 6.50265C20.9372 7.55667 20.2713 8.39752 19.2315 8.39752Z" fill="#2D2D31"/> + <path d="M23.6553 12H25.0339V8.81202H25.139C25.396 9.191 25.9451 9.74762 27.0316 9.74762C28.6672 9.74762 29.8588 8.35015 29.8588 6.4908C29.8588 4.61962 28.5854 3.23399 26.9381 3.23399C25.8867 3.23399 25.3727 3.81429 25.1273 4.13405H25.0222V3.38795H23.6553V12ZM26.7395 8.43305C25.7933 8.43305 25.0105 7.72247 25.0105 6.4908C25.0105 5.43678 25.6764 4.54856 26.7162 4.54856C27.6858 4.54856 28.4452 5.31835 28.4452 6.4908C28.4452 7.63957 27.7092 8.43305 26.7395 8.43305Z" fill="#2D2D31"/> + <path d="M30.5701 12H31.9487V8.81202H32.0538C32.3108 9.191 32.8599 9.74762 33.9464 9.74762C35.582 9.74762 36.66 8.35015 36.66 6.4908C36.66 4.61962 35.5002 3.23399 33.8529 3.23399C32.8015 3.23399 32.2875 3.81429 32.0421 4.13405H31.937V3.38795H30.5701V12ZM33.6543 8.43305C32.708 8.43305 31.9253 7.72247 31.9253 6.4908C31.9253 5.43678 32.5912 4.54856 33.631 4.54856C34.6006 4.54856 35.36 5.31835 35.36 6.4908C35.36 7.63957 34.624 8.43305 33.6543 8.43305Z" fill="#2D2D31"/> + <path d="M38.4823 9.73776H40.4333L41.5431 4.87031H41.6132L42.7231 9.73776H44.6624L46.2153 3.53205H44.8259L43.7161 8.41135H43.6109L42.5011 3.53205H40.6669L39.5454 8.41135H39.4403L38.3421 3.53205H36.8701L38.4823 9.73776Z" fill="#2D2D31"/> + <path d="M46.9137 9.73776H48.2923V6.67044C48.2923 5.49798 48.8297 4.77556 49.8344 4.77556H50.4418V3.37809H49.9862C49.2035 3.37809 48.6077 3.92287 48.374 4.44396H48.2806V3.53205H46.9137V9.73776Z" fill="#2D2D31"/> + <path d="M57.2829 9.73776H58.3577V8.49425H57.2946C56.874 8.49425 56.6988 8.30476 56.6988 7.86657V4.76372H58.4278V3.53205H56.6988V1.79114H55.3903V3.53205H54.2454V4.76372H55.3085V7.87842C55.3085 9.19299 56.0913 9.73776 57.2829 9.73776Z" fill="#2D2D31"/> + <path d="M62.0561 9.74762C63.3295 9.74762 64.451 9.1081 64.8482 7.81721L63.5865 7.5093C63.3645 8.19619 62.722 8.55148 62.0444 8.55148C61.0397 8.55148 60.3738 7.88827 60.3621 6.84609H65.0001V6.45527C65.0001 4.60777 63.8669 3.23399 61.9977 3.23399C60.3504 3.23399 58.9368 4.54856 58.9368 6.50265C58.9368 8.39752 60.1869 9.74762 62.0561 9.74762ZM60.3738 5.8276C60.4556 5.08149 61.1215 4.45381 61.9977 4.45381C62.8388 4.45381 63.5281 4.98675 63.5982 5.8276H60.3738Z" fill="#2D2D31"/> + <path fill-rule="evenodd" clip-rule="evenodd" d="M53.6325 9.73776H52.2539V4.76372H51.1791V3.53205H53.6325V9.73776Z" fill="#2D2D31"/> + <path d="M52.841 2.67085C53.3434 2.67085 53.7172 2.29187 53.7172 1.79447C53.7172 1.30891 53.3434 0.929932 52.841 0.929932C52.3387 0.929932 51.9648 1.30891 51.9648 1.79447C51.9648 2.29187 52.3387 2.67085 52.841 2.67085Z" fill="#2D2D31"/> + <path d="M12.0363 8.21609V10.9548H5.29451C3.33035 10.9548 1.61537 9.85334 0.697814 8.21609C0.564426 7.97807 0.447681 7.72836 0.349751 7.46917C0.157509 6.96127 0.0366636 6.41627 0 5.84762V5.10717C0.00795985 4.98044 0.0205026 4.85471 0.0369048 4.73048C0.0704326 4.47553 0.121086 4.22606 0.18766 3.98356C0.817453 1.68455 2.86531 0 5.29451 0C7.72371 0 9.77132 1.68455 10.4011 3.98356H7.51844C7.04519 3.23415 6.22605 2.7387 5.29451 2.7387C4.36296 2.7387 3.54382 3.23415 3.07057 3.98356C2.92633 4.21137 2.81441 4.46258 2.74108 4.73048C2.67596 4.968 2.64122 5.21846 2.64122 5.47739C2.64122 6.2624 2.96106 6.96999 3.47387 7.46917C3.94905 7.93251 4.5897 8.21609 5.29451 8.21609H12.0363Z" fill="#FD366E"/> + <path d="M12.0364 4.73047V7.46917H7.11523C7.62804 6.96998 7.94788 6.2624 7.94788 5.47739C7.94788 5.21846 7.91315 4.96799 7.84802 4.73047H12.0364Z" fill="#FD366E"/> + </svg> + + <svg id="appwrite-preview-logo-dark" width="65" height="12" viewBox="0 0 65 12" fill="none" xmlns="http://www.w3.org/2000/svg"> + <path d="M18.9862 9.74762C20.0493 9.74762 20.5867 9.191 20.8204 8.81202H20.9255C20.9722 9.21468 21.2526 9.59366 21.8017 9.59366H22.8414V8.40936H22.5727C22.3858 8.40936 22.2924 8.30277 22.2924 8.13697V3.38795H20.9138V4.1459H20.8087C20.54 3.76692 19.9792 3.23399 18.9511 3.23399C17.3156 3.23399 16.1006 4.60777 16.1006 6.4908C16.1006 8.37383 17.3389 9.74762 18.9862 9.74762ZM19.2315 8.39752C18.2619 8.39752 17.5025 7.6751 17.5025 6.50265C17.5025 5.35388 18.2385 4.57224 19.2198 4.57224C20.1544 4.57224 20.9372 5.27098 20.9372 6.50265C20.9372 7.55667 20.2713 8.39752 19.2315 8.39752Z" fill="#EDEDF0"/> + <path d="M23.6553 12H25.0339V8.81202H25.139C25.396 9.191 25.9451 9.74762 27.0316 9.74762C28.6672 9.74762 29.8588 8.35015 29.8588 6.4908C29.8588 4.61962 28.5854 3.23399 26.9381 3.23399C25.8867 3.23399 25.3727 3.81429 25.1273 4.13405H25.0222V3.38795H23.6553V12ZM26.7395 8.43305C25.7933 8.43305 25.0105 7.72247 25.0105 6.4908C25.0105 5.43678 25.6764 4.54856 26.7162 4.54856C27.6858 4.54856 28.4452 5.31835 28.4452 6.4908C28.4452 7.63957 27.7092 8.43305 26.7395 8.43305Z" fill="#EDEDF0"/> + <path d="M30.5701 12H31.9487V8.81202H32.0538C32.3108 9.191 32.8599 9.74762 33.9464 9.74762C35.582 9.74762 36.66 8.35015 36.66 6.4908C36.66 4.61962 35.5002 3.23399 33.8529 3.23399C32.8015 3.23399 32.2875 3.81429 32.0421 4.13405H31.937V3.38795H30.5701V12ZM33.6543 8.43305C32.708 8.43305 31.9253 7.72247 31.9253 6.4908C31.9253 5.43678 32.5912 4.54856 33.631 4.54856C34.6006 4.54856 35.36 5.31835 35.36 6.4908C35.36 7.63957 34.624 8.43305 33.6543 8.43305Z" fill="#EDEDF0"/> + <path d="M38.4823 9.73776H40.4333L41.5431 4.87031H41.6132L42.7231 9.73776H44.6624L46.2153 3.53205H44.8259L43.7161 8.41135H43.6109L42.5011 3.53205H40.6669L39.5454 8.41135H39.4403L38.3421 3.53205H36.8701L38.4823 9.73776Z" fill="#EDEDF0"/> + <path d="M46.9137 9.73776H48.2923V6.67044C48.2923 5.49798 48.8297 4.77556 49.8344 4.77556H50.4418V3.37809H49.9862C49.2035 3.37809 48.6077 3.92287 48.374 4.44396H48.2806V3.53205H46.9137V9.73776Z" fill="#EDEDF0"/> + <path d="M57.2829 9.73776H58.3577V8.49425H57.2946C56.874 8.49425 56.6988 8.30476 56.6988 7.86657V4.76372H58.4278V3.53205H56.6988V1.79114H55.3903V3.53205H54.2454V4.76372H55.3085V7.87842C55.3085 9.19299 56.0913 9.73776 57.2829 9.73776Z" fill="#EDEDF0"/> + <path d="M62.0561 9.74762C63.3295 9.74762 64.451 9.1081 64.8482 7.81721L63.5865 7.5093C63.3645 8.19619 62.722 8.55148 62.0444 8.55148C61.0397 8.55148 60.3738 7.88827 60.3621 6.84609H65.0001V6.45527C65.0001 4.60777 63.8669 3.23399 61.9977 3.23399C60.3504 3.23399 58.9368 4.54856 58.9368 6.50265C58.9368 8.39752 60.1869 9.74762 62.0561 9.74762ZM60.3738 5.8276C60.4556 5.08149 61.1215 4.45381 61.9977 4.45381C62.8388 4.45381 63.5281 4.98675 63.5982 5.8276H60.3738Z" fill="#EDEDF0"/> + <path fill-rule="evenodd" clip-rule="evenodd" d="M53.6325 9.73776H52.2539V4.76372H51.1791V3.53205H53.6325V9.73776Z" fill="#EDEDF0"/> + <path d="M52.841 2.67085C53.3434 2.67085 53.7172 2.29187 53.7172 1.79447C53.7172 1.30891 53.3434 0.929932 52.841 0.929932C52.3387 0.929932 51.9648 1.30891 51.9648 1.79447C51.9648 2.29187 52.3387 2.67085 52.841 2.67085Z" fill="#EDEDF0"/> + <path d="M12.0363 8.21609V10.9548H5.29451C3.33035 10.9548 1.61537 9.85334 0.697814 8.21609C0.564426 7.97807 0.447681 7.72836 0.349751 7.46917C0.157509 6.96127 0.0366636 6.41627 0 5.84762V5.10717C0.00795985 4.98044 0.0205026 4.85471 0.0369048 4.73048C0.0704326 4.47553 0.121086 4.22606 0.18766 3.98356C0.817453 1.68455 2.86531 0 5.29451 0C7.72371 0 9.77132 1.68455 10.4011 3.98356H7.51844C7.04519 3.23415 6.22605 2.7387 5.29451 2.7387C4.36296 2.7387 3.54382 3.23415 3.07057 3.98356C2.92633 4.21137 2.81441 4.46258 2.74108 4.73048C2.67596 4.968 2.64122 5.21846 2.64122 5.47739C2.64122 6.2624 2.96106 6.96999 3.47387 7.46917C3.94905 7.93251 4.5897 8.21609 5.29451 8.21609H12.0363Z" fill="#FD366E"/> + <path d="M12.0364 4.73047V7.46917H7.11523C7.62804 6.96998 7.94788 6.2624 7.94788 5.47739C7.94788 5.21846 7.91315 4.96799 7.84802 4.73047H12.0364Z" fill="#FD366E"/> + </svg> + </button> + + <script> + (function() { + var banner = document.getElementById("appwrite-preview"); + banner.addEventListener("click", function() { + banner.style.opacity = 0; + setTimeout(() => { + banner.style.display = 'none'; + }, 350); + }); + })(); + </script> + EOT; + + $this->output .= $banner; + } +} diff --git a/src/Appwrite/Transformation/Transformation.php b/src/Appwrite/Transformation/Transformation.php new file mode 100644 index 0000000000..d01ee08179 --- /dev/null +++ b/src/Appwrite/Transformation/Transformation.php @@ -0,0 +1,74 @@ +<?php + +namespace Appwrite\Transformation; + +class Transformation +{ + /** + * @var array<Adapter> $adapters + */ + protected array $adapters; + + /** + * @var array<mixed> $traits + */ + protected array $traits; + + protected mixed $input; + protected mixed $output; + + /** + * @param array<Adapter> $adapters + */ + public function __construct(array $adapters = []) + { + $this->adapters = $adapters; + } + + /** + * @param array<mixed> $traits + */ + public function setTraits(array $traits): self + { + $this->traits = $traits; + return $this; + } + + public function setInput(mixed $input): self + { + $this->input = $input; + return $this; + } + + public function addAdapter(Adapter $adapter): self + { + $this->adapters[] = $adapter; + return $this; + } + + public function transform(): bool + { + foreach ($this->adapters as $adapter) { + if (!$adapter->isValid($this->traits)) { + return false; + } + } + + $output = $this->input; + + foreach ($this->adapters as $adapter) { + $adapter->setInput($output); + $adapter->transform(); + $output = $adapter->getOutput(); + } + + $this->output = $output; + + return true; + } + + public function getOutput(): mixed + { + return $this->output; + } +} diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Deployments.php b/src/Appwrite/Utopia/Database/Validator/Queries/Deployments.php index 42aed88ef6..73631ecfb8 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Deployments.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Deployments.php @@ -5,13 +5,13 @@ namespace Appwrite\Utopia\Database\Validator\Queries; class Deployments extends Base { public const ALLOWED_ATTRIBUTES = [ - 'size', - 'buildId', + 'buildSize', + 'sourceSize', + 'totalSize', + 'buildDuration', + 'status', 'activate', - 'entrypoint', - 'commands', 'type', - 'size' ]; /** diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/DevKeys.php b/src/Appwrite/Utopia/Database/Validator/Queries/DevKeys.php new file mode 100644 index 0000000000..d9dbbeadc4 --- /dev/null +++ b/src/Appwrite/Utopia/Database/Validator/Queries/DevKeys.php @@ -0,0 +1,20 @@ +<?php + +namespace Appwrite\Utopia\Database\Validator\Queries; + +class DevKeys extends Base +{ + public const ALLOWED_ATTRIBUTES = [ + 'accessedAt', + 'expire', + ]; + + /** + * Expression constructor + * + */ + public function __construct() + { + parent::__construct('devKeys', self::ALLOWED_ATTRIBUTES); + } +} diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/FileTokens.php b/src/Appwrite/Utopia/Database/Validator/Queries/FileTokens.php new file mode 100644 index 0000000000..c712ab3261 --- /dev/null +++ b/src/Appwrite/Utopia/Database/Validator/Queries/FileTokens.php @@ -0,0 +1,19 @@ +<?php + +namespace Appwrite\Utopia\Database\Validator\Queries; + +class FileTokens extends Base +{ + public const ALLOWED_ATTRIBUTES = [ + 'expire', + ]; + + /** + * Expression constructor + * + */ + public function __construct() + { + parent::__construct('files', self::ALLOWED_ATTRIBUTES); + } +} diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Functions.php b/src/Appwrite/Utopia/Database/Validator/Queries/Functions.php index 89f5d52c81..894ee26e3f 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Functions.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Functions.php @@ -8,7 +8,7 @@ class Functions extends Base 'name', 'enabled', 'runtime', - 'deployment', + 'deploymentId', 'schedule', 'scheduleNext', 'schedulePrevious', diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Logs.php b/src/Appwrite/Utopia/Database/Validator/Queries/Logs.php new file mode 100644 index 0000000000..d07d3dd3d2 --- /dev/null +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Logs.php @@ -0,0 +1,24 @@ +<?php + +namespace Appwrite\Utopia\Database\Validator\Queries; + +class Logs extends Base +{ + public const ALLOWED_ATTRIBUTES = [ + 'status', + 'responseStatusCode', + 'duration', + 'requestMethod', + 'requestPath', + 'deploymentId' + ]; + + /** + * Expression constructor + * + */ + public function __construct() + { + parent::__construct('executions', self::ALLOWED_ATTRIBUTES); //TODO: Update this later + } +} diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Memberships.php b/src/Appwrite/Utopia/Database/Validator/Queries/Memberships.php index 5ff0098662..cef562ba2c 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Memberships.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Memberships.php @@ -9,12 +9,12 @@ class Memberships extends Base 'teamId', 'invited', 'joined', - 'confirm' + 'confirm', + 'roles', ]; /** * Expression constructor - * */ public function __construct() { diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Rules.php b/src/Appwrite/Utopia/Database/Validator/Queries/Rules.php index 24cb4475f2..c8057162a8 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Rules.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Rules.php @@ -6,9 +6,12 @@ class Rules extends Base { public const ALLOWED_ATTRIBUTES = [ 'domain', - 'resourceType', - 'resourceId', - 'url' + 'type', + 'trigger', + 'deploymentResourceType', + 'deploymentResourceId', + 'deploymentId', + 'deploymentVcsProviderBranch' ]; /** diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Sites.php b/src/Appwrite/Utopia/Database/Validator/Queries/Sites.php new file mode 100644 index 0000000000..35d4bdb5ef --- /dev/null +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Sites.php @@ -0,0 +1,26 @@ +<?php + +namespace Appwrite\Utopia\Database\Validator\Queries; + +class Sites extends Base +{ + public const ALLOWED_ATTRIBUTES = [ + 'name', + 'enabled', + 'framework', + 'deploymentId', + 'buildCommand', + 'installCommand', + 'outputDirectory', + 'installationId' + ]; + + /** + * Expression constructor + * + */ + public function __construct() + { + parent::__construct('sites', self::ALLOWED_ATTRIBUTES); + } +} diff --git a/src/Appwrite/Utopia/Request/Filters/V19.php b/src/Appwrite/Utopia/Request/Filters/V19.php new file mode 100644 index 0000000000..31296b2eb2 --- /dev/null +++ b/src/Appwrite/Utopia/Request/Filters/V19.php @@ -0,0 +1,25 @@ +<?php + +namespace Appwrite\Utopia\Request\Filters; + +use Appwrite\Utopia\Request\Filter; + +class V19 extends Filter +{ + // Convert 1.6 params to 1.7 + public function parse(array $content, string $model): array + { + switch ($model) { + case 'functions.create': + unset($content['templateRepository']); + unset($content['templateOwner']); + unset($content['templateRootDirectory']); + unset($content['templateVersion']); + break; + case 'functions.listExecutions': + unset($content['search']); + break; + } + return $content; + } +} diff --git a/src/Appwrite/Utopia/Response.php b/src/Appwrite/Utopia/Response.php index 1498f51bf6..3d69ac1291 100644 --- a/src/Appwrite/Utopia/Response.php +++ b/src/Appwrite/Utopia/Response.php @@ -31,7 +31,6 @@ use Appwrite\Utopia\Response\Model\AuthProvider; use Appwrite\Utopia\Response\Model\BaseList; use Appwrite\Utopia\Response\Model\Branch; use Appwrite\Utopia\Response\Model\Bucket; -use Appwrite\Utopia\Response\Model\Build; use Appwrite\Utopia\Response\Model\Collection; use Appwrite\Utopia\Response\Model\ConsoleVariables; use Appwrite\Utopia\Response\Model\Continent; @@ -39,12 +38,16 @@ use Appwrite\Utopia\Response\Model\Country; use Appwrite\Utopia\Response\Model\Currency; use Appwrite\Utopia\Response\Model\Database; use Appwrite\Utopia\Response\Model\Deployment; -use Appwrite\Utopia\Response\Model\Detection; +use Appwrite\Utopia\Response\Model\DetectionFramework; +use Appwrite\Utopia\Response\Model\DetectionRuntime; +use Appwrite\Utopia\Response\Model\DevKey; use Appwrite\Utopia\Response\Model\Document as ModelDocument; use Appwrite\Utopia\Response\Model\Error; use Appwrite\Utopia\Response\Model\ErrorDev; use Appwrite\Utopia\Response\Model\Execution; use Appwrite\Utopia\Response\Model\File; +use Appwrite\Utopia\Response\Model\Framework; +use Appwrite\Utopia\Response\Model\FrameworkAdapter; use Appwrite\Utopia\Response\Model\Func; use Appwrite\Utopia\Response\Model\Headers; use Appwrite\Utopia\Response\Model\HealthAntivirus; @@ -82,16 +85,22 @@ use Appwrite\Utopia\Response\Model\Preferences; use Appwrite\Utopia\Response\Model\Project; use Appwrite\Utopia\Response\Model\Provider; use Appwrite\Utopia\Response\Model\ProviderRepository; +use Appwrite\Utopia\Response\Model\ProviderRepositoryFramework; +use Appwrite\Utopia\Response\Model\ProviderRepositoryRuntime; +use Appwrite\Utopia\Response\Model\ResourceToken; use Appwrite\Utopia\Response\Model\Rule; use Appwrite\Utopia\Response\Model\Runtime; use Appwrite\Utopia\Response\Model\Session; +use Appwrite\Utopia\Response\Model\Site; use Appwrite\Utopia\Response\Model\Specification; use Appwrite\Utopia\Response\Model\Subscriber; use Appwrite\Utopia\Response\Model\Target; use Appwrite\Utopia\Response\Model\Team; use Appwrite\Utopia\Response\Model\TemplateEmail; +use Appwrite\Utopia\Response\Model\TemplateFramework; use Appwrite\Utopia\Response\Model\TemplateFunction; use Appwrite\Utopia\Response\Model\TemplateRuntime; +use Appwrite\Utopia\Response\Model\TemplateSite; use Appwrite\Utopia\Response\Model\TemplateSMS; use Appwrite\Utopia\Response\Model\TemplateVariable; use Appwrite\Utopia\Response\Model\Token; @@ -103,6 +112,8 @@ use Appwrite\Utopia\Response\Model\UsageDatabases; use Appwrite\Utopia\Response\Model\UsageFunction; use Appwrite\Utopia\Response\Model\UsageFunctions; use Appwrite\Utopia\Response\Model\UsageProject; +use Appwrite\Utopia\Response\Model\UsageSite; +use Appwrite\Utopia\Response\Model\UsageSites; use Appwrite\Utopia\Response\Model\UsageStorage; use Appwrite\Utopia\Response\Model\UsageUsers; use Appwrite\Utopia\Response\Model\User; @@ -142,6 +153,8 @@ class Response extends SwooleResponse public const MODEL_USAGE_STORAGE = 'usageStorage'; public const MODEL_USAGE_FUNCTIONS = 'usageFunctions'; public const MODEL_USAGE_FUNCTION = 'usageFunction'; + public const MODEL_USAGE_SITES = 'usageSites'; + public const MODEL_USAGE_SITE = 'usageSite'; public const MODEL_USAGE_PROJECT = 'usageProject'; // Database @@ -201,6 +214,8 @@ class Response extends SwooleResponse public const MODEL_FILE_LIST = 'fileList'; public const MODEL_BUCKET = 'bucket'; public const MODEL_BUCKET_LIST = 'bucketList'; + public const MODEL_RESOURCE_TOKEN = 'resourceToken'; + public const MODEL_RESOURCE_TOKEN_LIST = 'resourceTokenList'; // Locale public const MODEL_LOCALE = 'locale'; @@ -240,12 +255,27 @@ class Response extends SwooleResponse public const MODEL_INSTALLATION_LIST = 'installationList'; public const MODEL_PROVIDER_REPOSITORY = 'providerRepository'; public const MODEL_PROVIDER_REPOSITORY_LIST = 'providerRepositoryList'; + public const MODEL_PROVIDER_REPOSITORY_FRAMEWORK = 'providerRepositoryFramework'; + public const MODEL_PROVIDER_REPOSITORY_FRAMEWORK_LIST = 'providerRepositoryFrameworkList'; + public const MODEL_PROVIDER_REPOSITORY_RUNTIME = 'providerRepositoryRuntime'; + public const MODEL_PROVIDER_REPOSITORY_RUNTIME_LIST = 'providerRepositoryRuntimeList'; public const MODEL_BRANCH = 'branch'; public const MODEL_BRANCH_LIST = 'branchList'; - public const MODEL_DETECTION = 'detection'; + public const MODEL_DETECTION_FRAMEWORK = 'detectionFramework'; + public const MODEL_DETECTION_RUNTIME = 'detectionRuntime'; public const MODEL_VCS_CONTENT = 'vcsContent'; public const MODEL_VCS_CONTENT_LIST = 'vcsContentList'; + // Sites + public const MODEL_SITE = 'site'; + public const MODEL_SITE_LIST = 'siteList'; + public const MODEL_FRAMEWORK = 'framework'; + public const MODEL_FRAMEWORK_LIST = 'frameworkList'; + public const MODEL_FRAMEWORK_ADAPTER = 'frameworkAdapter'; + public const MODEL_TEMPLATE_SITE = 'templateSite'; + public const MODEL_TEMPLATE_SITE_LIST = 'templateSiteList'; + public const MODEL_TEMPLATE_FRAMEWORK = 'templateFramework'; + // Functions public const MODEL_FUNCTION = 'function'; public const MODEL_FUNCTION_LIST = 'functionList'; @@ -255,8 +285,6 @@ class Response extends SwooleResponse public const MODEL_DEPLOYMENT_LIST = 'deploymentList'; public const MODEL_EXECUTION = 'execution'; public const MODEL_EXECUTION_LIST = 'executionList'; - public const MODEL_BUILD = 'build'; - public const MODEL_BUILD_LIST = 'buildList'; // Not used anywhere yet public const MODEL_FUNC_PERMISSIONS = 'funcPermissions'; public const MODEL_HEADERS = 'headers'; public const MODEL_SPECIFICATION = 'specification'; @@ -284,6 +312,8 @@ class Response extends SwooleResponse public const MODEL_WEBHOOK_LIST = 'webhookList'; public const MODEL_KEY = 'key'; public const MODEL_KEY_LIST = 'keyList'; + public const MODEL_DEV_KEY = 'devKey'; + public const MODEL_DEV_KEY_LIST = 'devKeyList'; public const MODEL_MOCK_NUMBER = 'mockNumber'; public const MODEL_AUTH_PROVIDER = 'authProvider'; public const MODEL_AUTH_PROVIDER_LIST = 'authProviderList'; @@ -356,20 +386,25 @@ class Response extends SwooleResponse ->setModel(new BaseList('Logs List', self::MODEL_LOG_LIST, 'logs', self::MODEL_LOG)) ->setModel(new BaseList('Files List', self::MODEL_FILE_LIST, 'files', self::MODEL_FILE)) ->setModel(new BaseList('Buckets List', self::MODEL_BUCKET_LIST, 'buckets', self::MODEL_BUCKET)) + ->setModel(new BaseList('Resource Tokens List', self::MODEL_RESOURCE_TOKEN_LIST, 'tokens', self::MODEL_RESOURCE_TOKEN)) ->setModel(new BaseList('Teams List', self::MODEL_TEAM_LIST, 'teams', self::MODEL_TEAM)) ->setModel(new BaseList('Memberships List', self::MODEL_MEMBERSHIP_LIST, 'memberships', self::MODEL_MEMBERSHIP)) + ->setModel(new BaseList('Sites List', self::MODEL_SITE_LIST, 'sites', self::MODEL_SITE)) + ->setModel(new BaseList('Site Templates List', self::MODEL_TEMPLATE_SITE_LIST, 'templates', self::MODEL_TEMPLATE_SITE)) ->setModel(new BaseList('Functions List', self::MODEL_FUNCTION_LIST, 'functions', self::MODEL_FUNCTION)) ->setModel(new BaseList('Function Templates List', self::MODEL_TEMPLATE_FUNCTION_LIST, 'templates', self::MODEL_TEMPLATE_FUNCTION)) ->setModel(new BaseList('Installations List', self::MODEL_INSTALLATION_LIST, 'installations', self::MODEL_INSTALLATION)) - ->setModel(new BaseList('Provider Repositories List', self::MODEL_PROVIDER_REPOSITORY_LIST, 'providerRepositories', self::MODEL_PROVIDER_REPOSITORY)) + ->setModel(new BaseList('Framework Provider Repositories List', self::MODEL_PROVIDER_REPOSITORY_FRAMEWORK_LIST, 'frameworkProviderRepositories', self::MODEL_PROVIDER_REPOSITORY_FRAMEWORK)) + ->setModel(new BaseList('Runtime Provider Repositories List', self::MODEL_PROVIDER_REPOSITORY_RUNTIME_LIST, 'runtimeProviderRepositories', self::MODEL_PROVIDER_REPOSITORY_RUNTIME)) ->setModel(new BaseList('Branches List', self::MODEL_BRANCH_LIST, 'branches', self::MODEL_BRANCH)) + ->setModel(new BaseList('Frameworks List', self::MODEL_FRAMEWORK_LIST, 'frameworks', self::MODEL_FRAMEWORK)) ->setModel(new BaseList('Runtimes List', self::MODEL_RUNTIME_LIST, 'runtimes', self::MODEL_RUNTIME)) ->setModel(new BaseList('Deployments List', self::MODEL_DEPLOYMENT_LIST, 'deployments', self::MODEL_DEPLOYMENT)) ->setModel(new BaseList('Executions List', self::MODEL_EXECUTION_LIST, 'executions', self::MODEL_EXECUTION)) - ->setModel(new BaseList('Builds List', self::MODEL_BUILD_LIST, 'builds', self::MODEL_BUILD)) // Not used anywhere yet ->setModel(new BaseList('Projects List', self::MODEL_PROJECT_LIST, 'projects', self::MODEL_PROJECT, true, false)) ->setModel(new BaseList('Webhooks List', self::MODEL_WEBHOOK_LIST, 'webhooks', self::MODEL_WEBHOOK, true, false)) ->setModel(new BaseList('API Keys List', self::MODEL_KEY_LIST, 'keys', self::MODEL_KEY, true, false)) + ->setModel(new BaseList('Dev Keys List', self::MODEL_DEV_KEY_LIST, 'devKeys', self::MODEL_DEV_KEY, true, false)) ->setModel(new BaseList('Auth Providers List', self::MODEL_AUTH_PROVIDER_LIST, 'platforms', self::MODEL_AUTH_PROVIDER, true, false)) ->setModel(new BaseList('Platforms List', self::MODEL_PLATFORM_LIST, 'platforms', self::MODEL_PLATFORM, true, false)) ->setModel(new BaseList('Countries List', self::MODEL_COUNTRY_LIST, 'countries', self::MODEL_COUNTRY)) @@ -427,24 +462,33 @@ class Response extends SwooleResponse ->setModel(new LocaleCode()) ->setModel(new File()) ->setModel(new Bucket()) + ->setModel(new ResourceToken()) ->setModel(new Team()) ->setModel(new Membership()) + ->setModel(new Site()) + ->setModel(new TemplateSite()) + ->setModel(new TemplateFramework()) ->setModel(new Func()) ->setModel(new TemplateFunction()) ->setModel(new TemplateRuntime()) ->setModel(new TemplateVariable()) ->setModel(new Installation()) ->setModel(new ProviderRepository()) - ->setModel(new Detection()) + ->setModel(new ProviderRepositoryFramework()) + ->setModel(new ProviderRepositoryRuntime()) + ->setModel(new DetectionFramework()) + ->setModel(new DetectionRuntime()) ->setModel(new VcsContent()) ->setModel(new Branch()) ->setModel(new Runtime()) + ->setModel(new Framework()) + ->setModel(new FrameworkAdapter()) ->setModel(new Deployment()) ->setModel(new Execution()) - ->setModel(new Build()) ->setModel(new Project()) ->setModel(new Webhook()) ->setModel(new Key()) + ->setModel(new DevKey()) ->setModel(new MockNumber()) ->setModel(new AuthProvider()) ->setModel(new Platform()) @@ -470,6 +514,8 @@ class Response extends SwooleResponse ->setModel(new UsageBuckets()) ->setModel(new UsageFunctions()) ->setModel(new UsageFunction()) + ->setModel(new UsageSites()) + ->setModel(new UsageSite()) ->setModel(new UsageProject()) ->setModel(new Headers()) ->setModel(new Specification()) diff --git a/src/Appwrite/Utopia/Response/Filters/V19.php b/src/Appwrite/Utopia/Response/Filters/V19.php new file mode 100644 index 0000000000..8ab430e569 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Filters/V19.php @@ -0,0 +1,119 @@ +<?php + +namespace Appwrite\Utopia\Response\Filters; + +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Filter; + +class V19 extends Filter +{ + // Convert 1.7 Data format to 1.6 format + public function parse(array $content, string $model): array + { + $parsedResponse = $content; + + $parsedResponse = match($model) { + Response::MODEL_FUNCTION => $this->parseFunction($content), + Response::MODEL_FUNCTION_LIST => $this->handleList($content, 'functions', fn ($item) => $this->parseFunction($item)), + Response::MODEL_DEPLOYMENT => $this->parseDeployment($content), + Response::MODEL_PROXY_RULE => $this->parseProxyRule($content), + Response::MODEL_MIGRATION => $this->parseMigration($content), + Response::MODEL_PROJECT => $this->parseProject($content), + Response::MODEL_PROVIDER_REPOSITORY => $this->parseProviderRepository($content), + Response::MODEL_TEMPLATE_VARIABLE => $this->parseTemplateVariable($content), + Response::MODEL_USAGE_FUNCTION => $this->parseUsageFunction($content), + Response::MODEL_USAGE_FUNCTIONS => $this->parseUsageFunctions($content), + Response::MODEL_VARIABLE => $this->parseVariable($content), + default => $parsedResponse, + }; + + return $parsedResponse; + } + + protected function parseFunction(array $content) + { + $content['deployment'] = $content['deploymentId'] ?? ''; + unset($content['deploymentId']); + unset($content['deploymentCreatedAt']); + unset($content['latestDeploymentId']); + unset($content['latestDeploymentCreatedAt']); + unset($content['latestDeploymentStatus']); + return $content; + } + + protected function parseDeployment(array $content) + { + $content['size'] = $content['sourceSize'] ?? ''; + $content['buildTime'] = $content['buildDuration'] ?? ''; + unset($content['sourceSize']); + unset($content['buildDuration']); + unset($content['totalSize']); + unset($content['screenshotLight']); + unset($content['screenshotDark']); + return $content; + } + + protected function parseProxyRule(array $content) + { + $content['resourceType'] = $content['deploymentResourceType'] ?? ''; + $content['resourceId'] = $content['deploymentResourceId'] ?? ''; + unset($content['deploymentResourceType']); + unset($content['deploymentResourceId']); + unset($content['type']); + unset($content['trigger']); + unset($content['triggerData']); + unset($content['redirectStatusCode']); + unset($content['deploymentId']); + unset($content['deploymentVcsProviderBranch']); + return $content; + } + + protected function parseMigration(array $content) + { + unset($content['resourceId']); + return $content; + } + + protected function parseProject(array $content) + { + unset($content['devKeys']); + return $content; + } + + protected function parseProviderRepository(array $content) + { + unset($content['runtime']); + return $content; + } + + protected function parseTemplateVariable(array $content) + { + unset($content['secret']); + return $content; + } + + protected function parseUsageFunction(array $content) + { + unset($content['buildsSuccessTotal']); + unset($content['buildsFailedTotal']); + unset($content['buildsTimeAverage']); + unset($content['buildsSuccess']); + unset($content['buildsFailed']); + return $content; + } + + protected function parseUsageFunctions(array $content) + { + unset($content['buildsSuccessTotal']); + unset($content['buildsFailedTotal']); + unset($content['buildsSuccess']); + unset($content['buildsFailed']); + return $content; + } + + protected function parseVariable(array $content) + { + unset($content['secret']); + return $content; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Build.php b/src/Appwrite/Utopia/Response/Model/Build.php deleted file mode 100644 index d80c17645a..0000000000 --- a/src/Appwrite/Utopia/Response/Model/Build.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php - -namespace Appwrite\Utopia\Response\Model; - -use Appwrite\Utopia\Response; -use Appwrite\Utopia\Response\Model; - -class Build extends Model -{ - public function __construct() - { - $this - ->addRule('$id', [ - 'type' => self::TYPE_STRING, - 'description' => 'Build ID.', - 'default' => '', - 'example' => '5e5ea5c16897e', - ]) - ->addRule('deploymentId', [ - 'type' => self::TYPE_STRING, - 'description' => 'The deployment that created this build.', - 'default' => '', - 'example' => '5e5ea5c16897e', - ]) - // Build Status - // Failed - The deployment build has failed. More details can usually be found in buildStderr - // Ready - The deployment build was successful and the deployment is ready to be deployed - // Processing - The deployment is currently waiting to have a build triggered - // Building - The deployment is currently being built - ->addRule('status', [ - 'type' => self::TYPE_STRING, - 'description' => 'The build status. There are a few different types and each one means something different. \nFailed - The deployment build has failed. More details can usually be found in buildStderr\nReady - The deployment build was successful and the deployment is ready to be deployed\nProcessing - The deployment is currently waiting to have a build triggered\nBuilding - The deployment is currently being built', - 'default' => '', - 'example' => 'ready', - ]) - ->addRule('stdout', [ - 'type' => self::TYPE_STRING, - 'description' => 'The stdout of the build.', - 'default' => '', - 'example' => '', - ]) - ->addRule('stderr', [ - 'type' => self::TYPE_STRING, - 'description' => 'The stderr of the build.', - 'default' => '', - 'example' => '', - ]) - ->addRule('startTime', [ - 'type' => self::TYPE_DATETIME, - 'description' => 'The deployment creation date in ISO 8601 format.', - 'default' => '', - 'example' => self::TYPE_DATETIME_EXAMPLE, - ]) - ->addRule('endTime', [ - 'type' => self::TYPE_DATETIME, - 'description' => 'The time the build was finished in ISO 8601 format.', - 'default' => '', - 'example' => self::TYPE_DATETIME_EXAMPLE, - ]) - ->addRule('duration', [ - 'type' => self::TYPE_INTEGER, - 'description' => 'The build duration in seconds.', - 'default' => 0, - 'example' => 0, - ]) - ->addRule('size', [ - 'type' => self::TYPE_INTEGER, - 'description' => 'The code size in bytes.', - 'default' => 0, - 'example' => 128, - ]) - ; - } - - /** - * Get Name - * - * @return string - */ - public function getName(): string - { - return 'Build'; - } - - /** - * Get Type - * - * @return string - */ - public function getType(): string - { - return Response::MODEL_BUILD; - } -} diff --git a/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php index a82b8008cc..97dae2efcd 100644 --- a/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php +++ b/src/Appwrite/Utopia/Response/Model/ConsoleVariables.php @@ -10,19 +10,31 @@ class ConsoleVariables extends Model public function __construct() { $this - ->addRule('_APP_DOMAIN_TARGET', [ - 'type' => self::TYPE_STRING, - 'description' => 'CNAME target for your Appwrite custom domains.', - 'default' => '', - 'example' => 'appwrite.io', - ]) + ->addRule('_APP_DOMAIN_TARGET_CNAME', [ + 'type' => self::TYPE_STRING, + 'description' => 'CNAME target for your Appwrite custom domains.', + 'default' => '', + 'example' => 'appwrite.io', + ]) + ->addRule('_APP_DOMAIN_TARGET_A', [ + 'type' => self::TYPE_STRING, + 'description' => 'A target for your Appwrite custom domains.', + 'default' => '', + 'example' => '127.0.0.1', + ]) + ->addRule('_APP_DOMAIN_TARGET_AAAA', [ + 'type' => self::TYPE_STRING, + 'description' => 'AAAA target for your Appwrite custom domains.', + 'default' => '', + 'example' => '::1', + ]) ->addRule('_APP_STORAGE_LIMIT', [ 'type' => self::TYPE_INTEGER, 'description' => 'Maximum file size allowed for file upload in bytes.', 'default' => '', 'example' => '30000000', ]) - ->addRule('_APP_FUNCTIONS_SIZE_LIMIT', [ + ->addRule('_APP_COMPUTE_SIZE_LIMIT', [ 'type' => self::TYPE_INTEGER, 'description' => 'Maximum file size allowed for deployment in bytes.', 'default' => '', @@ -51,7 +63,37 @@ class ConsoleVariables extends Model 'description' => 'Defines if AI assistant is enabled.', 'default' => false, 'example' => true, - ]); + ]) + ->addRule('_APP_DOMAIN_SITES', [ + 'type' => self::TYPE_STRING, + 'description' => 'A domain to use for site URLs.', + 'default' => '', + 'example' => 'sites.localhost', + ]) + ->addRule('_APP_DOMAIN_FUNCTIONS', [ + 'type' => self::TYPE_STRING, + 'description' => 'A domain to use for function URLs.', + 'default' => '', + 'example' => 'functions.localhost', + ]) + ->addRule( + '_APP_OPTIONS_FORCE_HTTPS', + [ + 'type' => self::TYPE_STRING, + 'description' => 'Defines if HTTPS is enforced for all requests.', + 'default' => '', + 'example' => 'enabled', + ] + ) + ->addRule( + '_APP_DOMAINS_NAMESERVERS', + [ + 'type' => self::TYPE_STRING, + 'description' => 'Comma-separated list of nameservers.', + 'default' => '', + 'example' => 'ns1.example.com,ns2.example.com', + ] + ); } /** diff --git a/src/Appwrite/Utopia/Response/Model/Deployment.php b/src/Appwrite/Utopia/Response/Model/Deployment.php index 91a9f40956..55c1589af0 100644 --- a/src/Appwrite/Utopia/Response/Model/Deployment.php +++ b/src/Appwrite/Utopia/Response/Model/Deployment.php @@ -52,7 +52,7 @@ class Deployment extends Model 'default' => '', 'example' => 'index.js', ]) - ->addRule('size', [ + ->addRule('sourceSize', [ 'type' => self::TYPE_INTEGER, 'description' => 'The code size in bytes.', 'default' => 0, @@ -64,6 +64,12 @@ class Deployment extends Model 'default' => 0, 'example' => 128, ]) + ->addRule('totalSize', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'The total size in bytes (source and build output).', + 'default' => 0, + 'example' => 128, + ]) ->addRule('buildId', [ 'type' => self::TYPE_STRING, 'description' => 'The current build ID.', @@ -76,9 +82,21 @@ class Deployment extends Model 'default' => false, 'example' => true, ]) + ->addRule('screenshotLight', [ + 'type' => self::TYPE_STRING, + 'description' => 'Screenshot with light theme preference file ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('screenshotDark', [ + 'type' => self::TYPE_STRING, + 'description' => 'Screenshot with dark theme preference file ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) ->addRule('status', [ 'type' => self::TYPE_STRING, - 'description' => 'The deployment status. Possible values are "processing", "building", "waiting", "ready", and "failed".', + 'description' => 'The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed".', 'default' => '', 'example' => 'ready', ]) @@ -88,7 +106,7 @@ class Deployment extends Model 'default' => '', 'example' => 'Compiling source files...', ]) - ->addRule('buildTime', [ + ->addRule('buildDuration', [ 'type' => self::TYPE_INTEGER, 'description' => 'The current build time in seconds.', 'default' => 0, diff --git a/src/Appwrite/Utopia/Response/Model/DetectionFramework.php b/src/Appwrite/Utopia/Response/Model/DetectionFramework.php new file mode 100644 index 0000000000..9aeb885f76 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/DetectionFramework.php @@ -0,0 +1,58 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; + +class DetectionFramework extends Model +{ + public function __construct() + { + $this + ->addRule('framework', [ + 'type' => self::TYPE_STRING, + 'description' => 'Framework', + 'default' => '', + 'example' => 'nuxt', + ]) + ->addRule('installCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site Install Command', + 'default' => '', + 'example' => 'npm install', + ]) + ->addRule('buildCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site Build Command', + 'default' => '', + 'example' => 'npm run build', + ]) + ->addRule('outputDirectory', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site Output Directory', + 'default' => '', + 'example' => 'dist', + ]); + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'DetectionFramework'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_DETECTION_FRAMEWORK; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Detection.php b/src/Appwrite/Utopia/Response/Model/DetectionRuntime.php similarity index 50% rename from src/Appwrite/Utopia/Response/Model/Detection.php rename to src/Appwrite/Utopia/Response/Model/DetectionRuntime.php index c71baa0b0c..1c7c0be16b 100644 --- a/src/Appwrite/Utopia/Response/Model/Detection.php +++ b/src/Appwrite/Utopia/Response/Model/DetectionRuntime.php @@ -5,7 +5,7 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Model; -class Detection extends Model +class DetectionRuntime extends Model { public function __construct() { @@ -15,6 +15,18 @@ class Detection extends Model 'description' => 'Runtime', 'default' => '', 'example' => 'node', + ]) + ->addRule('entrypoint', [ + 'type' => self::TYPE_STRING, + 'description' => 'Function Entrypoint', + 'default' => '', + 'example' => 'index.js', + ]) + ->addRule('commands', [ + 'type' => self::TYPE_STRING, + 'description' => 'Function install and build commands', + 'default' => '', + 'example' => 'npm install && npm run build', ]); } @@ -25,7 +37,7 @@ class Detection extends Model */ public function getName(): string { - return 'Detection'; + return 'DetectionRuntime'; } /** @@ -35,6 +47,6 @@ class Detection extends Model */ public function getType(): string { - return Response::MODEL_DETECTION; + return Response::MODEL_DETECTION_RUNTIME; } } diff --git a/src/Appwrite/Utopia/Response/Model/DevKey.php b/src/Appwrite/Utopia/Response/Model/DevKey.php new file mode 100644 index 0000000000..b8da6c0cfc --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/DevKey.php @@ -0,0 +1,89 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; + +class DevKey extends Model +{ + /** + * @var bool + */ + protected bool $public = false; + + public function __construct() + { + $this + ->addRule('$id', [ + 'type' => self::TYPE_STRING, + 'description' => 'Key ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('$createdAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Key creation date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('$updatedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Key update date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'Key name.', + 'default' => '', + 'example' => 'Dev API Key', + ]) + ->addRule('expire', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Key expiration date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('secret', [ + 'type' => self::TYPE_STRING, + 'description' => 'Secret key.', + 'default' => '', + 'example' => '919c2d18fb5d4...a2ae413da83346ad2', + ]) + ->addRule('accessedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Most recent access date in ISO 8601 format. This attribute is only updated again after ' . APP_KEY_ACCESS / 60 / 60 . ' hours.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE + ]) + ->addRule('sdks', [ + 'type' => self::TYPE_STRING, + 'description' => 'List of SDK user agents that used this key.', + 'default' => null, + 'example' => 'appwrite:flutter', + 'array' => true + ]) + ; + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'DevKey'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_DEV_KEY; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Execution.php b/src/Appwrite/Utopia/Response/Model/Execution.php index c5842bb42c..d7d30fe549 100644 --- a/src/Appwrite/Utopia/Response/Model/Execution.php +++ b/src/Appwrite/Utopia/Response/Model/Execution.php @@ -5,6 +5,7 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Model; use Utopia\Database\DateTime; +use Utopia\Database\Document; use Utopia\Database\Helpers\Role; class Execution extends Model @@ -108,7 +109,7 @@ class Execution extends Model ]) ->addRule('duration', [ 'type' => self::TYPE_FLOAT, - 'description' => 'Function execution duration in seconds.', + 'description' => 'Resource(function/site) execution duration in seconds.', 'default' => 0, 'example' => 0.400, ]) @@ -141,4 +142,18 @@ class Execution extends Model { return Response::MODEL_EXECUTION; } + + + /** + * Convert DB structure to response model + * + * @return Document + */ + public function filter(Document $document): Document + { + $document->removeAttribute('resourceType'); + $document->setAttribute('functionId', $document->getAttribute('resourceId', '')); + $document->removeAttribute('resourceId'); + return $document; + } } diff --git a/src/Appwrite/Utopia/Response/Model/Framework.php b/src/Appwrite/Utopia/Response/Model/Framework.php new file mode 100644 index 0000000000..14d4052133 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/Framework.php @@ -0,0 +1,67 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; + +class Framework extends Model +{ + public function __construct() + { + $this + ->addRule('key', [ + 'type' => self::TYPE_STRING, + 'description' => 'Framework key.', + 'default' => '', + 'example' => 'sveltekit', + ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'Framework Name.', + 'default' => '', + 'example' => 'SvelteKit' + ]) + ->addRule('buildRuntime', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default runtime version.', + 'default' => '', + 'example' => 'node-22', + ]) + ->addRule('runtimes', [ + 'type' => self::TYPE_STRING, + 'description' => 'List of supported runtime versions.', + 'default' => '', + 'example' => ['static-1', 'node-22'], + 'array' => true, + ]) + ->addRule('adapters', [ + 'type' => Response::MODEL_FRAMEWORK_ADAPTER, + 'description' => 'List of supported adapters.', + 'default' => '', + 'example' => [[ 'key' => 'static', 'buildRuntime' => 'node-22', 'buildCommand' => 'npm run build', 'installCommand' => 'npm install', 'outputDirectory' => './dist' ]], + 'array' => true, + ]) + ; + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'Framework'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_FRAMEWORK; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/FrameworkAdapter.php b/src/Appwrite/Utopia/Response/Model/FrameworkAdapter.php new file mode 100644 index 0000000000..afbd78eda4 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/FrameworkAdapter.php @@ -0,0 +1,65 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; + +class FrameworkAdapter extends Model +{ + public function __construct() + { + $this + ->addRule('key', [ + 'type' => self::TYPE_STRING, + 'description' => 'Adapter key.', + 'default' => '', + 'example' => 'static', + ]) + ->addRule('installCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default command to download dependencies.', + 'default' => '', + 'example' => 'npm install', + ]) + ->addRule('buildCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default command to build site into output directory.', + 'default' => '', + 'example' => 'npm run build', + ]) + ->addRule('outputDirectory', [ + 'type' => self::TYPE_STRING, + 'description' => 'Default output directory of build.', + 'default' => '', + 'example' => './dist', + ]) + ->addRule('fallbackFile', [ + 'type' => self::TYPE_STRING, + 'description' => 'Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed.', + 'default' => null, + 'example' => 'index.html', + ]) + ; + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'Framework Adapter'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_FRAMEWORK_ADAPTER; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Func.php b/src/Appwrite/Utopia/Response/Model/Func.php index ab2d7ba051..e33d7663fd 100644 --- a/src/Appwrite/Utopia/Response/Model/Func.php +++ b/src/Appwrite/Utopia/Response/Model/Func.php @@ -55,22 +55,46 @@ class Func extends Model ]) ->addRule('logging', [ 'type' => self::TYPE_BOOLEAN, - 'description' => 'Whether executions will be logged. When set to false, executions will not be logged, but will reduce resource used by your Appwrite project.', + 'description' => 'When disabled, executions will exclude logs and errors, and will be slightly faster.', 'default' => true, 'example' => false, ]) ->addRule('runtime', [ 'type' => self::TYPE_STRING, - 'description' => 'Function execution runtime.', + 'description' => 'Function execution and build runtime.', 'default' => '', 'example' => 'python-3.8', ]) - ->addRule('deployment', [ + ->addRule('deploymentId', [ 'type' => self::TYPE_STRING, 'description' => 'Function\'s active deployment ID.', 'default' => '', 'example' => '5e5ea5c16897e', ]) + ->addRule('deploymentCreatedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Active deployment creation date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('latestDeploymentId', [ + 'type' => self::TYPE_STRING, + 'description' => 'Function\'s latest deployment ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('latestDeploymentCreatedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Latest deployment creation date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('latestDeploymentStatus', [ + 'type' => self::TYPE_STRING, + 'description' => 'Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed".', + 'default' => '', + 'example' => 'ready', + ]) ->addRule('scopes', [ 'type' => self::TYPE_STRING, 'description' => 'Allowed permission scopes.', @@ -119,7 +143,7 @@ class Func extends Model ->addRule('version', [ 'type' => self::TYPE_STRING, 'description' => 'Version of Open Runtimes used for the function.', - 'default' => 'v4', + 'default' => 'v5', 'example' => 'v2', ]) ->addRule('installationId', [ @@ -155,8 +179,8 @@ class Func extends Model ->addRule('specification', [ 'type' => self::TYPE_STRING, 'description' => 'Machine specification for builds and executions.', - 'default' => APP_FUNCTION_SPECIFICATION_DEFAULT, - 'example' => APP_FUNCTION_SPECIFICATION_DEFAULT, + 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, + 'example' => APP_COMPUTE_SPECIFICATION_DEFAULT, ]) ; } diff --git a/src/Appwrite/Utopia/Response/Model/Migration.php b/src/Appwrite/Utopia/Response/Model/Migration.php index f70dc37027..3be1d519a6 100644 --- a/src/Appwrite/Utopia/Response/Model/Migration.php +++ b/src/Appwrite/Utopia/Response/Model/Migration.php @@ -59,6 +59,13 @@ class Migration extends Model 'example' => ['user'], 'array' => true ]) + ->addRule('resourceId', [ + 'type' => self::TYPE_STRING, + 'description' => 'Id of the resource to migrate.', + 'default' => '', + 'example' => 'databaseId:collectionId', + 'array' => false + ]) ->addRule('statusCounters', [ 'type' => self::TYPE_JSON, 'description' => 'A group of counters that represent the total progress of the migration.', diff --git a/src/Appwrite/Utopia/Response/Model/Project.php b/src/Appwrite/Utopia/Response/Model/Project.php index fbbe062531..efd002654e 100644 --- a/src/Appwrite/Utopia/Response/Model/Project.php +++ b/src/Appwrite/Utopia/Response/Model/Project.php @@ -197,6 +197,13 @@ class Project extends Model 'example' => new \stdClass(), 'array' => true, ]) + ->addRule('devKeys', [ + 'type' => Response::MODEL_DEV_KEY, + 'description' => 'List of dev keys.', + 'default' => [], + 'example' => new \stdClass(), + 'array' => true, + ]) ->addRule('smtpEnabled', [ 'type' => self::TYPE_BOOLEAN, 'description' => 'Status for custom SMTP', diff --git a/src/Appwrite/Utopia/Response/Model/ProviderRepository.php b/src/Appwrite/Utopia/Response/Model/ProviderRepository.php index c133ae3164..518b5de9ee 100644 --- a/src/Appwrite/Utopia/Response/Model/ProviderRepository.php +++ b/src/Appwrite/Utopia/Response/Model/ProviderRepository.php @@ -41,12 +41,6 @@ class ProviderRepository extends Model 'default' => false, 'example' => true, ]) - ->addRule('runtime', [ - 'type' => self::TYPE_STRING, - 'description' => 'Auto-detected runtime suggestion. Empty if getting response of getRuntime().', - 'default' => '', - 'example' => 'node', - ]) ->addRule('pushedAt', [ 'type' => self::TYPE_DATETIME, 'description' => 'Last commit date in ISO 8601 format.', diff --git a/src/Appwrite/Utopia/Response/Model/ProviderRepositoryFramework.php b/src/Appwrite/Utopia/Response/Model/ProviderRepositoryFramework.php new file mode 100644 index 0000000000..24556f4453 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/ProviderRepositoryFramework.php @@ -0,0 +1,40 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; + +class ProviderRepositoryFramework extends ProviderRepository +{ + public function __construct() + { + parent::__construct(); + + $this->addRule('framework', [ + 'type' => self::TYPE_STRING, + 'description' => 'Auto-detected framework. Empty if type is not "framework".', + 'default' => '', + 'example' => 'nextjs', + ]); + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'ProviderRepositoryFramework'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_PROVIDER_REPOSITORY_FRAMEWORK; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/ProviderRepositoryRuntime.php b/src/Appwrite/Utopia/Response/Model/ProviderRepositoryRuntime.php new file mode 100644 index 0000000000..ea20eeea47 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/ProviderRepositoryRuntime.php @@ -0,0 +1,40 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; + +class ProviderRepositoryRuntime extends ProviderRepository +{ + public function __construct() + { + parent::__construct(); + + $this->addRule('runtime', [ + 'type' => self::TYPE_STRING, + 'description' => 'Auto-detected runtime. Empty if type is not "runtime".', + 'default' => '', + 'example' => 'node-22', + ]); + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'ProviderRepositoryRuntime'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_PROVIDER_REPOSITORY_RUNTIME; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/ResourceToken.php b/src/Appwrite/Utopia/Response/Model/ResourceToken.php new file mode 100644 index 0000000000..ef186c3d0b --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/ResourceToken.php @@ -0,0 +1,107 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Ahc\Jwt\JWT; +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; +use Utopia\Database\Document; +use Utopia\System\System; + +class ResourceToken extends Model +{ + public function __construct() + { + $this + ->addRule('$id', [ + 'type' => self::TYPE_STRING, + 'description' => 'Token ID.', + 'default' => '', + 'example' => 'bb8ea5c16897e', + ]) + ->addRule('$createdAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Token creation date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('resourceId', [ + 'type' => self::TYPE_STRING, + 'description' => 'Resource ID.', + 'default' => '', + 'example' => '5e5ea5c168bb8:5e5ea5c168bb8', + ]) + ->addRule('resourceType', [ + 'type' => self::TYPE_STRING, + 'description' => 'Resource type.', + 'default' => '', + 'example' => TOKENS_RESOURCE_TYPE_FILES, + ]) + ->addRule('expire', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Token expiration date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('secret', [ + 'type' => self::TYPE_STRING, + 'description' => 'JWT encoded string.', + 'default' => '', + // this is a secret but is converted to a JWT token when sent back to the client after filter. + 'example' => 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c', + ]) + ->addRule('accessedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Most recent access date in ISO 8601 format. This attribute is only updated again after ' . APP_RESOURCE_TOKEN_ACCESS / 60 / 60 . ' hours.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE + ]) + ; + } + + public function filter(Document $document): Document + { + $maxAge = PHP_INT_MAX; + $expire = $document->getAttribute('expire'); + + if ($expire !== null) { + $now = new \DateTime(); + $expiryDate = new \DateTime($expire); + + // set 1 min if expired, we check for expiry later on route hooks for validation! + $maxAge = min(60, $expiryDate->getTimestamp() - $now->getTimestamp()); + } + + $jwt = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', $maxAge, 10); + $secret = $jwt->encode([ + 'tokenId' => $document->getId(), + 'resourceId' => $document->getAttribute('resourceId'), + 'resourceType' => $document->getAttribute('resourceType'), + 'resourceInternalId' => $document->getAttribute('resourceInternalId'), + ]); + + $document->setAttribute('secret', $secret); + + return $document; + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'ResourceToken'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_RESOURCE_TOKEN; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Rule.php b/src/Appwrite/Utopia/Response/Model/Rule.php index 932591b90f..12903b270e 100644 --- a/src/Appwrite/Utopia/Response/Model/Rule.php +++ b/src/Appwrite/Utopia/Response/Model/Rule.php @@ -34,17 +34,53 @@ class Rule extends Model 'default' => '', 'example' => 'appwrite.company.com', ]) - ->addRule('resourceType', [ + ->addRule('type', [ 'type' => self::TYPE_STRING, - 'description' => 'Action definition for the rule. Possible values are "api", "function", or "redirect"', + 'description' => 'Action definition for the rule. Possible values are "api", "deployment", or "redirect"', + 'default' => '', + 'example' => 'deployment', + ]) + ->addRule('trigger', [ + 'type' => self::TYPE_STRING, + 'description' => 'Defines how the rule was created. Possible values are "manual" or "deployment"', + 'default' => '', + 'example' => 'manual', + ]) + ->addRule('redirectUrl', [ + 'type' => self::TYPE_STRING, + 'description' => 'URL to redirect to. Used if type is "redirect"', + 'default' => '', + 'example' => 'https://appwrite.io/docs', + ]) + ->addRule('redirectStatusCode', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Status code to apply during redirect. Used if type is "redirect"', + 'default' => '', + 'example' => 301, + ]) + ->addRule('deploymentId', [ + 'type' => self::TYPE_STRING, + 'description' => 'ID of deployment. Used if type is "deployment"', + 'default' => '', + 'example' => 'n3u9feiwmf', + ]) + ->addRule('deploymentResourceType', [ + 'type' => self::TYPE_STRING, + 'description' => 'Type of deployment. Possible values are "function", "site". Used if rule\'s type is "deployment".', 'default' => '', 'example' => 'function', ]) - ->addRule('resourceId', [ + ->addRule('deploymentResourceId', [ 'type' => self::TYPE_STRING, - 'description' => 'ID of resource for the action type. If resourceType is "api" or "url", it is empty. If resourceType is "function", it is ID of the function.', + 'description' => 'ID deployment\'s resource. Used if type is "deployment"', 'default' => '', - 'example' => 'myAwesomeFunction', + 'example' => 'n3u9feiwmf', + ]) + ->addRule('deploymentVcsProviderBranch', [ + 'type' => self::TYPE_STRING, + 'description' => 'Name of Git branch that updates rule. Used if type is "deployment"', + 'default' => '', + 'example' => 'function', ]) ->addRule('status', [ 'type' => self::TYPE_STRING, diff --git a/src/Appwrite/Utopia/Response/Model/Site.php b/src/Appwrite/Utopia/Response/Model/Site.php new file mode 100644 index 0000000000..e6e205909b --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/Site.php @@ -0,0 +1,210 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; + +class Site extends Model +{ + public function __construct() + { + $this + ->addRule('$id', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('$createdAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Site creation date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('$updatedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Site update date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site name.', + 'default' => '', + 'example' => 'My Site', + ]) + ->addRule('enabled', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Site enabled.', + 'default' => true, + 'example' => false, + ]) + ->addRule('live', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Is the site deployed with the latest configuration? This is set to false if you\'ve changed an environment variables, entrypoint, commands, or other settings that needs redeploy to be applied. When the value is false, redeploy the site to update it with the latest configuration.', + 'default' => true, + 'example' => false, + ]) + ->addRule('logging', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'When disabled, request logs will exclude logs and errors, and site responses will be slightly faster.', + 'default' => true, + 'example' => false, + ]) + ->addRule('framework', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site framework.', + 'default' => '', + 'example' => 'react', + ]) + ->addRule('deploymentId', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site\'s active deployment ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('deploymentCreatedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Active deployment creation date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('deploymentScreenshotLight', [ + 'type' => self::TYPE_STRING, + 'description' => 'Screenshot of active deployment with light theme preference file ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('deploymentScreenshotDark', [ + 'type' => self::TYPE_STRING, + 'description' => 'Screenshot of active deployment with dark theme preference file ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('latestDeploymentId', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site\'s latest deployment ID.', + 'default' => '', + 'example' => '5e5ea5c16897e', + ]) + ->addRule('latestDeploymentCreatedAt', [ + 'type' => self::TYPE_DATETIME, + 'description' => 'Latest deployment creation date in ISO 8601 format.', + 'default' => '', + 'example' => self::TYPE_DATETIME_EXAMPLE, + ]) + ->addRule('latestDeploymentStatus', [ + 'type' => self::TYPE_STRING, + 'description' => 'Status of latest deployment. Possible values are "waiting", "processing", "building", "ready", and "failed".', + 'default' => '', + 'example' => 'ready', + ]) + ->addRule('vars', [ + 'type' => Response::MODEL_VARIABLE, + 'description' => 'Site variables.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('timeout', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Site request timeout in seconds.', + 'default' => 15, + 'example' => 300, + ]) + ->addRule('installCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'The install command used to install the site dependencies.', + 'default' => '', + 'example' => 'npm install', + ]) + ->addRule('buildCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'The build command used to build the site.', + 'default' => '', + 'example' => 'npm run build', + ]) + ->addRule('outputDirectory', [ + 'type' => self::TYPE_STRING, + 'description' => 'The directory where the site build output is located.', + 'default' => '', + 'example' => 'build', + ]) + ->addRule('installationId', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site VCS (Version Control System) installation id.', + 'default' => '', + 'example' => '6m40at4ejk5h2u9s1hboo', + ]) + ->addRule('providerRepositoryId', [ + 'type' => self::TYPE_STRING, + 'description' => 'VCS (Version Control System) Repository ID', + 'default' => '', + 'example' => 'appwrite', + ]) + ->addRule('providerBranch', [ + 'type' => self::TYPE_STRING, + 'description' => 'VCS (Version Control System) branch name', + 'default' => '', + 'example' => 'main', + ]) + ->addRule('providerRootDirectory', [ + 'type' => self::TYPE_STRING, + 'description' => 'Path to site in VCS (Version Control System) repository', + 'default' => '', + 'example' => 'sites/helloWorld', + ]) + ->addRule('providerSilentMode', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Is VCS (Version Control System) connection is in silent mode? When in silence mode, no comments will be posted on the repository pull or merge requests', + 'default' => false, + 'example' => false, + ]) + ->addRule('specification', [ + 'type' => self::TYPE_STRING, + 'description' => 'Machine specification for builds and executions.', + 'default' => APP_COMPUTE_SPECIFICATION_DEFAULT, + 'example' => APP_COMPUTE_SPECIFICATION_DEFAULT, + ]) + ->addRule('buildRuntime', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site build runtime.', + 'default' => '', + 'example' => 'node-22', + ]) + ->addRule('adapter', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site framework adapter.', + 'default' => null, + 'example' => 'static', + ]) + ->addRule('fallbackFile', [ + 'type' => self::TYPE_STRING, + 'description' => 'Name of fallback file to use instead of 404 page. If null, Appwrite 404 page will be displayed.', + 'default' => null, + 'example' => 'index.html', + ]) + ; + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'Site'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_SITE; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Specification.php b/src/Appwrite/Utopia/Response/Model/Specification.php index a7c7d7389e..4fa7fb9bc7 100644 --- a/src/Appwrite/Utopia/Response/Model/Specification.php +++ b/src/Appwrite/Utopia/Response/Model/Specification.php @@ -32,7 +32,7 @@ class Specification extends Model 'type' => self::TYPE_STRING, 'description' => 'Size slug.', 'default' => '', - 'example' => APP_FUNCTION_SPECIFICATION_DEFAULT + 'example' => APP_COMPUTE_SPECIFICATION_DEFAULT ]); } diff --git a/src/Appwrite/Utopia/Response/Model/TemplateFramework.php b/src/Appwrite/Utopia/Response/Model/TemplateFramework.php new file mode 100644 index 0000000000..ae94ca4425 --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/TemplateFramework.php @@ -0,0 +1,89 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; + +class TemplateFramework extends Model +{ + public function __construct() + { + $this + ->addRule('key', [ + 'type' => self::TYPE_STRING, + 'description' => 'Parent framework key.', + 'default' => '', + 'example' => 'sveltekit', + ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'Framework Name.', + 'default' => '', + 'example' => 'SvelteKit' + ]) + ->addRule('installCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'The install command used to install the dependencies.', + 'default' => '', + 'example' => 'npm install', + ]) + ->addRule('buildCommand', [ + 'type' => self::TYPE_STRING, + 'description' => 'The build command used to build the deployment.', + 'default' => '', + 'example' => 'npm run build', + ]) + ->addRule('outputDirectory', [ + 'type' => self::TYPE_STRING, + 'description' => 'The output directory to store the build output.', + 'default' => '', + 'example' => './build', + ]) + ->addRule('providerRootDirectory', [ + 'type' => self::TYPE_STRING, + 'description' => 'Path to site in VCS (Version Control System) repository', + 'default' => '', + 'example' => './svelte-kit/starter', + ]) + ->addRule('buildRuntime', [ + 'type' => self::TYPE_STRING, + 'description' => 'Runtime used during build step of template.', + 'default' => '', + 'example' => 'node-22', + ]) + ->addRule('adapter', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site framework runtime', + 'default' => '', + 'example' => 'ssr', + ]) + ->addRule('fallbackFile', [ + 'type' => self::TYPE_STRING, + 'description' => 'Fallback file for SPA. Only relevant for static serve runtime.', + 'default' => null, + 'example' => 'index.html', + ]) + ; + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'Template Framework'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_TEMPLATE_FRAMEWORK; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/TemplateSite.php b/src/Appwrite/Utopia/Response/Model/TemplateSite.php new file mode 100644 index 0000000000..053742dfdb --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/TemplateSite.php @@ -0,0 +1,116 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; +use Appwrite\Utopia\Response\Model; + +class TemplateSite extends Model +{ + public function __construct() + { + $this + ->addRule('key', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site Template ID.', + 'default' => '', + 'example' => 'starter', + ]) + ->addRule('name', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site Template Name.', + 'default' => '', + 'example' => 'Starter site', + ]) + ->addRule('tagline', [ + 'type' => self::TYPE_STRING, + 'description' => 'Short description of template', + 'default' => '', + 'example' => 'Minimal web app integrating with Appwrite.', + ]) + ->addRule('demoUrl', [ + 'type' => self::TYPE_STRING, + 'description' => 'URL hosting a template demo.', + 'default' => '', + 'example' => 'https://nextjs-starter.appwrite.network/', + ]) + ->addRule('screenshotDark', [ + 'type' => self::TYPE_STRING, + 'description' => 'File URL with preview screenshot in dark theme preference.', + 'default' => '', + 'example' => 'https://cloud.appwrite.io/images/sites/templates/template-for-blog-dark.png', + ]) + ->addRule('screenshotLight', [ + 'type' => self::TYPE_STRING, + 'description' => 'File URL with preview screenshot in light theme preference.', + 'default' => '', + 'example' => 'https://cloud.appwrite.io/images/sites/templates/template-for-blog-light.png', + ]) + ->addRule('useCases', [ + 'type' => self::TYPE_STRING, + 'description' => 'Site use cases.', + 'default' => [], + 'example' => 'Starter', + 'array' => true, + ]) + ->addRule('frameworks', [ + 'type' => Response::MODEL_TEMPLATE_FRAMEWORK, + 'description' => 'List of frameworks that can be used with this template.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('vcsProvider', [ + 'type' => self::TYPE_STRING, + 'description' => 'VCS (Version Control System) Provider.', + 'default' => '', + 'example' => 'github', + ]) + ->addRule('providerRepositoryId', [ + 'type' => self::TYPE_STRING, + 'description' => 'VCS (Version Control System) Repository ID', + 'default' => '', + 'example' => 'templates', + ]) + ->addRule('providerOwner', [ + 'type' => self::TYPE_STRING, + 'description' => 'VCS (Version Control System) Owner.', + 'default' => '', + 'example' => 'appwrite', + ]) + ->addRule('providerVersion', [ + 'type' => self::TYPE_STRING, + 'description' => 'VCS (Version Control System) branch version (tag).', + 'default' => '', + 'example' => 'main', + ]) + ->addRule('variables', [ + 'type' => Response::MODEL_TEMPLATE_VARIABLE, + 'description' => 'Site variables.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ; + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'Template Site'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_TEMPLATE_SITE; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/TemplateVariable.php b/src/Appwrite/Utopia/Response/Model/TemplateVariable.php index c992083a87..e196b29032 100644 --- a/src/Appwrite/Utopia/Response/Model/TemplateVariable.php +++ b/src/Appwrite/Utopia/Response/Model/TemplateVariable.php @@ -28,6 +28,12 @@ class TemplateVariable extends Model 'default' => '', 'example' => '512', ]) + ->addRule('secret', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Variable secret flag. Secret variables can only be updated or deleted, but never read.', + 'default' => false, + 'example' => false, + ]) ->addRule('placeholder', [ 'type' => self::TYPE_STRING, 'description' => 'Variable Placeholder.', diff --git a/src/Appwrite/Utopia/Response/Model/UsageFunction.php b/src/Appwrite/Utopia/Response/Model/UsageFunction.php index ac21c5ae0d..32a23250d4 100644 --- a/src/Appwrite/Utopia/Response/Model/UsageFunction.php +++ b/src/Appwrite/Utopia/Response/Model/UsageFunction.php @@ -34,6 +34,18 @@ class UsageFunction extends Model 'default' => 0, 'example' => 0, ]) + ->addRule('buildsSuccessTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of successful function builds.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('buildsFailedTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of failed function builds.', + 'default' => 0, + 'example' => 0, + ]) ->addRule('buildsStorageTotal', [ 'type' => self::TYPE_INTEGER, 'description' => 'total aggregated sum of function builds storage.', @@ -46,6 +58,12 @@ class UsageFunction extends Model 'default' => 0, 'example' => 0, ]) + ->addRule('buildsTimeAverage', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Average builds compute time.', + 'default' => 0, + 'example' => 0, + ]) ->addRule('buildsMbSecondsTotal', [ 'type' => self::TYPE_INTEGER, 'description' => 'Total aggregated sum of function builds mbSeconds.', @@ -133,6 +151,20 @@ class UsageFunction extends Model 'example' => [], 'array' => true ]) + ->addRule('buildsSuccess', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of successful builds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('buildsFailed', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of failed builds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) ; } diff --git a/src/Appwrite/Utopia/Response/Model/UsageFunctions.php b/src/Appwrite/Utopia/Response/Model/UsageFunctions.php index 90327a7e8a..6dc03c6293 100644 --- a/src/Appwrite/Utopia/Response/Model/UsageFunctions.php +++ b/src/Appwrite/Utopia/Response/Model/UsageFunctions.php @@ -97,6 +97,18 @@ class UsageFunctions extends Model 'example' => [], 'array' => true ]) + ->addRule('buildsSuccessTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of successful function builds.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('buildsFailedTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of failed function builds.', + 'default' => 0, + 'example' => 0, + ]) ->addRule('builds', [ 'type' => Response::MODEL_METRIC, 'description' => 'Aggregated number of functions build per period.', @@ -146,6 +158,20 @@ class UsageFunctions extends Model 'example' => [], 'array' => true ]) + ->addRule('buildsSuccess', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of successful function builds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('buildsFailed', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of failed function builds per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) ; } diff --git a/src/Appwrite/Utopia/Response/Model/UsageSite.php b/src/Appwrite/Utopia/Response/Model/UsageSite.php new file mode 100644 index 0000000000..c45dc831cd --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/UsageSite.php @@ -0,0 +1,74 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; + +class UsageSite extends UsageFunction +{ + public function __construct() + { + parent::__construct(); + $this + ->addRule('requestsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of requests.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('requests', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of requests per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('inboundTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated inbound bandwidth.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('inbound', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of inbound bandwidth per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('outboundTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated outbound bandwidth.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('outbound', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of outbound bandwidth per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ; + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'UsageSite'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_USAGE_SITE; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/UsageSites.php b/src/Appwrite/Utopia/Response/Model/UsageSites.php new file mode 100644 index 0000000000..74435b332c --- /dev/null +++ b/src/Appwrite/Utopia/Response/Model/UsageSites.php @@ -0,0 +1,89 @@ +<?php + +namespace Appwrite\Utopia\Response\Model; + +use Appwrite\Utopia\Response; + +class UsageSites extends UsageFunctions +{ + public function __construct() + { + parent::__construct(); + $this + ->removeRule('functionsTotal') + ->removeRule('functions') + ->addRule('sitesTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of sites.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('sites', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of sites per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('requestsTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated number of requests.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('requests', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of requests per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('inboundTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated inbound bandwidth.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('inbound', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of inbound bandwidth per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ->addRule('outboundTotal', [ + 'type' => self::TYPE_INTEGER, + 'description' => 'Total aggregated outbound bandwidth.', + 'default' => 0, + 'example' => 0, + ]) + ->addRule('outbound', [ + 'type' => Response::MODEL_METRIC, + 'description' => 'Aggregated number of outbound bandwidth per period.', + 'default' => [], + 'example' => [], + 'array' => true + ]) + ; + } + + /** + * Get Name + * + * @return string + */ + public function getName(): string + { + return 'UsageSites'; + } + + /** + * Get Type + * + * @return string + */ + public function getType(): string + { + return Response::MODEL_USAGE_SITES; + } +} diff --git a/src/Appwrite/Utopia/Response/Model/Variable.php b/src/Appwrite/Utopia/Response/Model/Variable.php index 88fcd14ca1..22f76e44d4 100644 --- a/src/Appwrite/Utopia/Response/Model/Variable.php +++ b/src/Appwrite/Utopia/Response/Model/Variable.php @@ -4,6 +4,7 @@ namespace Appwrite\Utopia\Response\Model; use Appwrite\Utopia\Response; use Appwrite\Utopia\Response\Model; +use Utopia\Database\Document; class Variable extends Model { @@ -41,6 +42,12 @@ class Variable extends Model 'default' => '', 'example' => 'myPa$$word1', ]) + ->addRule('secret', [ + 'type' => self::TYPE_BOOLEAN, + 'description' => 'Variable secret flag. Secret variables can only be updated or deleted, but never read.', + 'default' => false, + 'example' => false, + ]) ->addRule('resourceType', [ 'type' => self::TYPE_STRING, 'description' => 'Service to which the variable belongs. Possible values are "project", "function"', @@ -56,6 +63,21 @@ class Variable extends Model ; } + /** + * Filter + * + * @param Document $document + * @return Document + */ + public function filter(Document $document): Document + { + $secret = $document->getAttribute('secret'); + if ($secret === true) { + $document->setAttribute('value', null); + } + return $document; + } + /** * Get Name * diff --git a/src/Appwrite/Vcs/Comment.php b/src/Appwrite/Vcs/Comment.php index 18379f1099..62f6ef61d0 100644 --- a/src/Appwrite/Vcs/Comment.php +++ b/src/Appwrite/Vcs/Comment.php @@ -9,10 +9,11 @@ use Utopia\System\System; class Comment { + // TODO: Add more tips protected array $tips = [ - 'Appwrite has a Discord community with over 16 000 members. [Come join us!](https://appwrite.io/discord)', - 'You can use [Avatars API](https://appwrite.io/docs/client/avatars?sdk=web-default#avatarsGetQR) to generate QR code for any text or URLs', - '[Cursor pagination](https://appwrite.io/docs/pagination#cursor-pagination) performs better than offset pagination when loading further pages', + 'Appwrite has a Discord community with over 16 000 members.', + 'You can use Avatars API to generate QR code for any text or URLs.', + 'Cursor pagination performs better than offset pagination when loading further pages.', ]; protected string $statePrefix = '[appwrite]: #'; @@ -27,19 +28,21 @@ class Comment return \count($this->builds) === 0; } - public function addBuild(Document $project, Document $function, string $buildStatus, string $deploymentId, array $action): void + public function addBuild(Document $project, Document $resource, string $resourceType, string $buildStatus, string $deploymentId, array $action, string $previewUrl): void { // Unique index - $id = $project->getId() . '_' . $function->getId(); + $id = $project->getId() . '_' . $resource->getId(); $this->builds[$id] = [ 'projectName' => $project->getAttribute('name'), 'projectId' => $project->getId(), - 'functionName' => $function->getAttribute('name'), - 'functionId' => $function->getId(), + 'resourceName' => $resource->getAttribute('name'), + 'resourceId' => $resource->getId(), + 'resourceType' => $resourceType, 'buildStatus' => $buildStatus, 'deploymentId' => $deploymentId, 'action' => $action, + 'previewUrl' => $previewUrl, ]; } @@ -55,75 +58,152 @@ class Comment if (!\array_key_exists($build['projectId'], $projects)) { $projects[$build['projectId']] = [ 'name' => $build['projectName'], - 'functions' => [] + 'function' => [], + 'site' => [] ]; } - $projects[$build['projectId']]['functions'][$build['functionId']] = [ - 'name' => $build['functionName'], - 'status' => $build['buildStatus'], - 'deploymentId' => $build['deploymentId'], - 'action' => $build['action'], - ]; + if ($build['resourceType'] === 'site') { + $projects[$build['projectId']]['site'][$build['resourceId']] = [ + 'name' => $build['resourceName'], + 'status' => $build['buildStatus'], + 'deploymentId' => $build['deploymentId'], + 'action' => $build['action'], + 'previewUrl' => $build['previewUrl'], + ]; + } elseif ($build['resourceType'] === 'function') { + $projects[$build['projectId']]['function'][$build['resourceId']] = [ + 'name' => $build['resourceName'], + 'status' => $build['buildStatus'], + 'deploymentId' => $build['deploymentId'], + 'action' => $build['action'], + ]; + } } + $i = 0; foreach ($projects as $projectId => $project) { - $text .= "**{$project['name']}** `{$projectId}`\n\n"; - $text .= "| Function | ID | Status | Action |\n"; - $text .= "| :- | :- | :- | :- |\n"; - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; $hostname = System::getEnv('_APP_DOMAIN'); - foreach ($project['functions'] as $functionId => $function) { - if ($function['status'] === 'waiting' || $function['status'] === 'processing' || $function['status'] === 'building') { - $text .= "**Your function deployment is in progress. Please check back in a few minutes for the updated status.**\n\n"; - } elseif ($function['status'] === 'ready') { - $text .= "**Your function has been successfully deployed.**\n\n"; - } else { - $text .= "**Your function deployment has failed. Please check the logs for more details and retry.**\n\n"; + $text .= "## {$project['name']}\n\n"; + $text .= "Project ID: `{$projectId}`\n\n"; + + $isOpen = $i === 0; + + if (\count($project['site']) > 0) { + $text .= "<details" . ($isOpen ? ' open' : '') . ">\n"; + $text .= "<summary>Sites (" . \count($project['site']) . ")</summary>\n\n"; + $text .= "<br>\n\n"; + + $text .= "| Site | Status | Logs | Preview | QR\n"; + $text .= "| :- | :- | :- | :- | :- |\n"; + + foreach ($project['site'] as $siteId => $site) { + $extension = $site['status'] === 'building' ? 'gif' : 'png'; + + $pathLight = '/images/vcs/status-' . $site['status'] . '-light.' . $extension; + $pathDark = '/images/vcs/status-' . $site['status'] . '-dark.' . $extension; + + $status = match ($site['status']) { + 'waiting' => $this->generatImage($pathLight, $pathDark, 'Queued', 85) . ' _Queued_', + 'processing' => $this->generatImage($pathLight, $pathDark, 'Processing', 85) . ' _Processing_', + 'building' => $this->generatImage($pathLight, $pathDark, 'Building', 85) . ' _Building_', + 'ready' => $this->generatImage($pathLight, $pathDark, 'Ready', 85) . ' _Ready_', + 'failed' => $this->generatImage($pathLight, $pathDark, 'Failed', 85) . ' _Failed_', + }; + + if ($site['action']['type'] === 'logs') { + $action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $projectId . '/sites/site-' . $siteId . '/deployments/deployment-' . $site['deploymentId'] . ')'; + } else { + $action = '[Authorize](' . $site['action']['url'] . ')'; + } + + $qrImagePathLight = '/images/vcs/qr-light.svg'; + $qrImagePathDark = '/images/vcs/qr-dark.svg'; + + $consoleUrl = $protocol . '://' . $hostname . '/v1/avatars/qr?text=' . \urlencode($site['previewUrl']); + $qr = '[' . $this->generatImage($qrImagePathLight, $qrImagePathDark, 'QR Code', 28) . '](' . $consoleUrl . ')'; + + $preview = '[Preview URL](' . $site['previewUrl'] . ')'; + + $text .= "|  **{$site['name']}**<br>`$siteId`"; + $text .= "| {$status}"; + $text .= "| {$action}"; + $text .= "| {$preview}"; + $text .= "| {$qr}"; + $text .= "|\n"; } - $text .= "Project name: **{$project['name']}** \nProject ID: `{$projectId}`\n\n"; - $text .= "| Function | ID | Status | Action |\n"; - $text .= "| :- | :- | :- | :- |\n"; - - $generateImage = function (string $status) use ($protocol, $hostname) { - $extention = $status === 'building' ? 'gif' : 'png'; - $imagesUrl = $protocol . '://' . $hostname . '/images/vcs/'; - $imageUrl = '<picture><source media="(prefers-color-scheme: dark)" srcset="' . $imagesUrl . 'status-' . $status . '-dark.' . $extention . '"><img alt="' . $status . '" height="25" align="center" src="' . $imagesUrl . 'status-' . $status . '-light.' . $extention . '"></picture>'; - - return $imageUrl; - }; - - $status = match ($function['status']) { - 'waiting' => $generateImage('waiting') . ' Waiting to build', - 'processing' => $generateImage('processing') . ' Processing', - 'building' => $generateImage('building') . ' Building', - 'ready' => $generateImage('ready') . ' Ready', - 'failed' => $generateImage('failed') . ' Failed', - }; - - if ($function['action']['type'] === 'logs') { - $action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $projectId . '/functions/function-' . $functionId . '/deployment-' . $function['deploymentId'] . ')'; - } else { - $action = '[Authorize](' . $function['action']['url'] . ')'; - } - - $text .= "| {$function['name']} | `{$functionId}` | {$status} | {$action} |\n"; + $text .= "\n</details>\n\n"; } - $text .= "\n\n"; + if (\count($project['function']) > 0) { + $text .= "<details" . ($isOpen ? ' open' : '') . ">\n"; + $text .= "<summary>Functions (" . \count($project['function']) . ")</summary>\n\n"; + $text .= "<br>\n\n"; + $text .= "| Function | ID | Status | Logs |\n"; + $text .= "| :- | :- | :- | :- |\n"; + + foreach ($project['function'] as $functionId => $function) { + $extension = $site['status'] === 'building' ? 'gif' : 'png'; + + $pathLight = '/images/vcs/status-' . $site['status'] . '-light.' . $extension; + $pathDark = '/images/vcs/status-' . $site['status'] . '-dark.' . $extension; + + $status = match ($site['status']) { + 'waiting' => $this->generatImage($pathLight, $pathDark, 'Queued', 85) . ' _Queued_', + 'processing' => $this->generatImage($pathLight, $pathDark, 'Processing', 85) . ' _Processing_', + 'building' => $this->generatImage($pathLight, $pathDark, 'Building', 85) . ' _Building_', + 'ready' => $this->generatImage($pathLight, $pathDark, 'Ready', 85) . ' _Ready_', + 'failed' => $this->generatImage($pathLight, $pathDark, 'Failed', 85) . ' _Failed_', + }; + + if ($function['action']['type'] === 'logs') { + $action = '[View Logs](' . $protocol . '://' . $hostname . '/console/project-' . $projectId . '/functions/function-' . $functionId . '/deployment-' . $function['deploymentId'] . ')'; + } else { + $action = '[Authorize](' . $function['action']['url'] . ')'; + } + + $text .= "|  **{$function['name']}**<br>`$functionId`"; + $text .= "| {$status}"; + $text .= "| {$action}"; + $text .= "|\n"; + } + + $text .= "</details>\n\n"; + } + + $text .= "</details>\n\n"; + + $isLast = $i === \count($projects) - 1; + + if (\count($projects) > 1 && $isLast) { + $text .= "---\n\n"; + } + + $i++; } - $functionUrl = $protocol . '://' . $hostname . '/console/project-' . $projectId . '/functions/function-' . $functionId; - $text .= "Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to [your deployments]($functionUrl). Learn more about Appwrite [Function deployments](https://appwrite.io/docs/functions).\n\n"; $tip = $this->tips[array_rand($this->tips)]; - $text .= "> **💡 Did you know?** \n " . $tip . "\n\n"; + $text .= "\n<br>\n\n> [!NOTE]\n> $tip\n\n"; return $text; } + public function generatImage(string $pathLight, string $pathDark, string $alt, int $width): string + { + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') == 'disabled' ? 'http' : 'https'; + $hostname = System::getEnv('_APP_DOMAIN'); + + $imageLight = $protocol . '://' . $hostname . $pathLight; + $imageDark = $protocol . '://' . $hostname . $pathDark; + + $imageUrl = '<picture><source media="(prefers-color-scheme: dark)" srcset="' . $imageDark . '"><img alt="' . $alt . '" width="' . $width . '" align="center" src="' . $imageLight . '"></picture>'; + + return $imageUrl; + } + public function parseComment(string $comment): self { $state = \explode("\n", $comment)[0] ?? ''; diff --git a/src/Executor/Executor.php b/src/Executor/Executor.php index 6bc2fe7aab..c381ceeae3 100644 --- a/src/Executor/Executor.php +++ b/src/Executor/Executor.php @@ -64,19 +64,20 @@ class Executor string $version, float $cpus, int $memory, + int $timeout, bool $remove = false, string $entrypoint = '', string $destination = '', array $variables = [], string $command = null, + string $outputDirectory = '' ) { $runtimeId = "$projectId-$deploymentId-build"; $route = "/runtimes"; - $timeout = (int) System::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900); // Remove after migration - if ($version == 'v3') { - $version = 'v4'; + if ($version === 'v3' || $version === 'v4') { + $version = 'v5'; } $params = [ @@ -92,6 +93,7 @@ class Executor 'memory' => $memory, 'version' => $version, 'timeout' => $timeout, + 'outputDirectory' => $outputDirectory ]; $endpoint = $this->selectEndpoint($projectId, $deploymentId); @@ -116,10 +118,9 @@ class Executor public function getLogs( string $deploymentId, string $projectId, + string $timeout, callable $callback ) { - $timeout = (int) System::getEnv('_APP_FUNCTIONS_BUILD_TIMEOUT', 900); - $runtimeId = "$projectId-$deploymentId-build"; $route = "/runtimes/{$runtimeId}/logs"; $params = [ @@ -138,9 +139,9 @@ class Executor * @param string $projectId * @param string $deploymentId */ - public function deleteRuntime(string $projectId, string $deploymentId) + public function deleteRuntime(string $projectId, string $deploymentId, string $suffix = '') { - $runtimeId = "$projectId-$deploymentId"; + $runtimeId = "$projectId-$deploymentId" . $suffix; $route = "/runtimes/$runtimeId"; $endpoint = $this->selectEndpoint($projectId, $deploymentId); @@ -148,6 +149,11 @@ class Executor 'x-opr-addressing-method' => 'broadcast' ], [], true, 30); + // Temporary fix for race condition + if ($response['headers']['status-code'] === 500 && \str_contains($response['body']['message'], 'already in progress')) { + return true; // OK, removal already in progress + } + $status = $response['headers']['status-code']; if ($status >= 400) { $message = \is_string($response['body']) ? $response['body'] : $response['body']['message']; @@ -200,8 +206,8 @@ class Executor $route = '/runtimes/' . $runtimeId . '/executions'; // Remove after migration - if ($version == 'v3') { - $version = 'v4'; + if ($version === 'v3' || $version === 'v4') { + $version = 'v5'; } $params = [ @@ -253,6 +259,32 @@ class Executor return $response['body']; } + public function createCommand( + string $deploymentId, + string $projectId, + string $command, + int $timeout + ) { + $runtimeId = "$projectId-$deploymentId-build"; + $route = "/runtimes/$runtimeId/commands"; + + $params = [ + 'command' => $command, + 'timeout' => $timeout + ]; + + $endpoint = $this->selectEndpoint($projectId, $deploymentId); + $response = $this->call($endpoint, self::METHOD_POST, $route, [ 'x-opr-runtime-id' => $runtimeId ], $params, true, $timeout); + + $status = $response['headers']['status-code']; + if ($status >= 400) { + $message = \is_string($response['body']) ? $response['body'] : $response['body']['message']; + throw new \Exception($message, $status); + } + + return $response['body']; + } + /** * Call * diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index dc80808b14..278d1cd0d5 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -164,7 +164,7 @@ class Client * @return array * @throws Exception */ - public function call(string $method, string $path = '', array $headers = [], mixed $params = [], bool $decode = true): array + public function call(string $method, string $path = '', array $headers = [], mixed $params = [], bool $decode = true, bool $followRedirects = true): array { $headers = array_merge($this->headers, $headers); $ch = curl_init($this->endpoint . $path . (($method == self::METHOD_GET && !empty($params)) ? '?' . http_build_query($params) : '')); @@ -192,7 +192,7 @@ class Client curl_setopt($ch, CURLOPT_PATH_AS_IS, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, $followRedirects); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'); curl_setopt($ch, CURLOPT_HTTPHEADER, $formattedHeaders); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0); diff --git a/tests/e2e/General/UsageTest.php b/tests/e2e/General/UsageTest.php index 4473cab30c..5549ef800d 100644 --- a/tests/e2e/General/UsageTest.php +++ b/tests/e2e/General/UsageTest.php @@ -2,7 +2,7 @@ namespace Tests\E2E\General; -use Appwrite\Functions\Specification; +use Appwrite\Platform\Modules\Compute\Specification; use Appwrite\Tests\Retry; use CURLFile; use DateTime; @@ -11,16 +11,69 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; use Tests\E2E\Services\Functions\FunctionsBase; +use Tests\E2E\Services\Sites\SitesBase; +use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; -use Utopia\Database\Query; use Utopia\Database\Validator\Datetime as DatetimeValidator; +use Utopia\System\System; class UsageTest extends Scope { use ProjectCustom; use SideServer; use FunctionsBase; + use SitesBase { + FunctionsBase::createDeployment insteadof SitesBase; + FunctionsBase::setupDeployment insteadof SitesBase; + FunctionsBase::createVariable insteadof SitesBase; + FunctionsBase::getVariable insteadof SitesBase; + FunctionsBase::listVariables insteadof SitesBase; + FunctionsBase::updateVariable insteadof SitesBase; + FunctionsBase::deleteVariable insteadof SitesBase; + FunctionsBase::getDeployment insteadof SitesBase; + FunctionsBase::listDeployments insteadof SitesBase; + FunctionsBase::deleteDeployment insteadof SitesBase; + FunctionsBase::setupDuplicateDeployment insteadof SitesBase; + FunctionsBase::createDuplicateDeployment insteadof SitesBase; + FunctionsBase::createTemplateDeployment insteadof SitesBase; + FunctionsBase::getUsage insteadof SitesBase; + FunctionsBase::getTemplate insteadof SitesBase; + FunctionsBase::getDeploymentDownload insteadof SitesBase; + FunctionsBase::cancelDeployment insteadof SitesBase; + FunctionsBase::listSpecifications insteadof SitesBase; + SitesBase::createDeployment as createDeploymentSite; + SitesBase::setupDeployment as setupDeploymentSite; + SitesBase::createVariable as createVariableSite; + SitesBase::getVariable as getVariableSite; + SitesBase::listVariables as listVariablesSite; + SitesBase::listVariables as listVariablesSite; + SitesBase::updateVariable as updateVariableSite; + SitesBase::updateVariable as updateVariableSite; + SitesBase::deleteVariable as deleteVariableSite; + SitesBase::deleteVariable as deleteVariableSite; + SitesBase::getDeployment as getDeploymentSite; + SitesBase::getDeployment as getDeploymentSite; + SitesBase::listDeployments as listDeploymentsSite; + SitesBase::listDeployments as listDeploymentsSite; + SitesBase::deleteDeployment as deleteDeploymentSite; + SitesBase::deleteDeployment as deleteDeploymentSite; + SitesBase::setupDuplicateDeployment as setupDuplicateDeploymentSite; + SitesBase::setupDuplicateDeployment as setupDuplicateDeploymentSite; + SitesBase::createDuplicateDeployment as createDuplicateDeploymentSite; + SitesBase::createDuplicateDeployment as createDuplicateDeploymentSite; + SitesBase::createTemplateDeployment as createTemplateDeploymentSite; + SitesBase::createTemplateDeployment as createTemplateDeploymentSite; + SitesBase::getUsage as getUsageSite; + SitesBase::getUsage as getUsageSite; + SitesBase::getTemplate as getTemplateSite; + SitesBase::getTemplate as getTemplateSite; + SitesBase::getDeploymentDownload as getDeploymentDownloadSite; + SitesBase::getDeploymentDownload as getDeploymentDownloadSite; + SitesBase::cancelDeployment as cancelDeploymentSite; + SitesBase::cancelDeployment as cancelDeploymentSite; + SitesBase::listSpecifications as listSpecificationsSite; + } private const WAIT = 5; private const CREATE = 20; @@ -630,37 +683,23 @@ class UsageTest extends Scope $this->assertEquals(201, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); - $response = $this->client->call( - Client::METHOD_POST, - '/functions/' . $functionId . '/deployments', - array_merge([ - 'content-type' => 'multipart/form-data', - 'x-appwrite-project' => $this->getProject()['$id'] - ], $this->getHeaders()), - [ - 'entrypoint' => 'index.php', - 'code' => $this->packageFunction('php'), - 'activate' => true, - ] - ); - - $deploymentId = $response['body']['$id'] ?? ''; - - $this->assertEquals(202, $response['headers']['status-code']); - $this->assertNotEmpty($response['body']['$id']); - $this->assertEquals(true, (new DatetimeValidator())->isValid($response['body']['$createdAt'])); - $this->assertEquals('index.php', $response['body']['entrypoint']); - - // Wait for deployment to build. - sleep(self::WAIT + 20); + $deploymentId = $this->setupDeployment($functionId, [ + 'entrypoint' => 'index.php', + 'code' => $this->packageFunction('php'), + 'activate' => true, + ]); + $this->assertNotEmpty($deploymentId); $response = $this->client->call( Client::METHOD_PATCH, - '/functions/' . $functionId . '/deployments/' . $deploymentId, + '/functions/' . $functionId . '/deployment', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'] ], $this->getHeaders()), + [ + 'deploymentId' => $deploymentId, + ], ); $this->assertEquals(200, $response['headers']['status-code']); @@ -668,7 +707,7 @@ class UsageTest extends Scope $this->assertEquals(true, (new DatetimeValidator())->isValid($response['body']['$createdAt'])); $this->assertEquals(true, (new DatetimeValidator())->isValid($response['body']['$updatedAt'])); - $this->assertEquals($deploymentId, $response['body']['deployment']); + $this->assertEquals($deploymentId, $response['body']['deploymentId']); $response = $this->client->call( Client::METHOD_POST, @@ -774,7 +813,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(19, count($response['body'])); + $this->assertEquals(24, count($response['body'])); $this->assertEquals('30d', $response['body']['range']); $this->assertIsArray($response['body']['deployments']); $this->assertIsArray($response['body']['deploymentsStorage']); @@ -799,7 +838,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(21, count($response['body'])); + $this->assertEquals(25, count($response['body'])); $this->assertEquals($response['body']['range'], '30d'); $this->assertIsArray($response['body']['functions']); $this->assertIsArray($response['body']['deployments']); @@ -820,6 +859,145 @@ class UsageTest extends Scope return $data; } + + public function testPrepareSitesStats(): array + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + $deployment = $this->createDeploymentSite($siteId, [ + 'siteId' => $siteId, + 'code' => $this->packageSite('static'), + 'activate' => true, + ]); + + $this->assertEquals(202, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['$id']); + $this->assertEquals('waiting', $deployment['body']['status']); + $this->assertEquals(true, (new DatetimeValidator())->isValid($deployment['body']['$createdAt'])); + + $deploymentIdActive = $deployment['body']['$id'] ?? ''; + + $this->assertEventually(function () use ($siteId, $deploymentIdActive) { + $deployment = $this->getDeploymentSite($siteId, $deploymentIdActive); + + $this->assertEquals('ready', $deployment['body']['status']); + }, 50000, 500); + + $deployment = $this->createDeploymentSite($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'false' + ]); + + $this->assertEquals(202, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['$id']); + + $deploymentIdInactive = $deployment['body']['$id'] ?? ''; + + $this->assertEventually(function () use ($siteId, $deploymentIdInactive) { + $deployment = $this->getDeploymentSite($siteId, $deploymentIdInactive); + + $this->assertEquals('ready', $deployment['body']['status']); + }, 50000, 500); + + $site = $this->getSite($siteId); + + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deploymentIdActive, $site['body']['deploymentId']); + $this->assertNotEquals($deploymentIdInactive, $site['body']['deploymentId']); + + $data = [ + 'siteId' => $siteId, + 'deployments' => 2, + 'deploymentsSuccess' => 2, + 'deploymentsFailed' => 0 + ]; + + return $data; + } + + /** @depends testPrepareSitesStats */ + #[Retry(count: 1)] + public function testSitesStats(array $data) + { + $siteId = $data['siteId']; + $executionTime = $data['executionTime'] ?? 0; + $executions = $data['executions'] ?? 0; + $deploymentsSuccess = $data['deploymentsSuccess']; + $deploymentsFailed = $data['deploymentsFailed']; + $response = $this->client->call( + Client::METHOD_GET, + '/sites/' . $siteId . '/usage?range=30d', + $this->getConsoleHeaders() + ); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(30, count($response['body'])); + $this->assertEquals('30d', $response['body']['range']); + $this->assertIsArray($response['body']['deployments']); + $this->assertEquals($deploymentsSuccess, $response['body']['buildsSuccessTotal']); + $this->assertEquals($deploymentsFailed, $response['body']['buildsFailedTotal']); + $this->assertIsArray($response['body']['deploymentsStorage']); + $this->assertIsNumeric($response['body']['deploymentsStorageTotal']); + $this->assertIsNumeric($response['body']['buildsMbSecondsTotal']); + $this->assertIsNumeric($response['body']['executionsMbSecondsTotal']); + $this->assertIsArray($response['body']['builds']); + $this->assertIsArray($response['body']['buildsTime']); + $this->assertIsArray($response['body']['buildsMbSeconds']); + $this->assertIsArray($response['body']['executions']); + $this->assertIsArray($response['body']['executionsTime']); + $this->assertIsArray($response['body']['executionsMbSeconds']); + $this->assertIsArray($response['body']['buildsSuccess']); + $this->assertIsArray($response['body']['buildsFailed']); + $this->assertIsArray($response['body']['requests']); + $this->assertIsArray($response['body']['inbound']); + $this->assertIsArray($response['body']['outbound']); + $this->assertEquals($executions, $response['body']['executions'][array_key_last($response['body']['executions'])]['value']); + $this->validateDates($response['body']['executions']); + $this->assertEquals($executionTime, $response['body']['executionsTime'][array_key_last($response['body']['executionsTime'])]['value']); + $this->validateDates($response['body']['executionsTime']); + + $response = $this->client->call( + Client::METHOD_GET, + '/sites/usage?range=30d', + $this->getConsoleHeaders() + ); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(31, count($response['body'])); + $this->assertEquals($response['body']['range'], '30d'); + $this->assertIsArray($response['body']['sites']); + $this->assertIsArray($response['body']['deployments']); + $this->assertIsArray($response['body']['deploymentsStorage']); + $this->assertIsArray($response['body']['builds']); + $this->assertIsArray($response['body']['buildsTime']); + $this->assertIsArray($response['body']['buildsMbSeconds']); + $this->assertIsArray($response['body']['executions']); + $this->assertIsArray($response['body']['executionsTime']); + $this->assertIsArray($response['body']['executionsMbSeconds']); + $this->assertIsArray($response['body']['buildsSuccess']); + $this->assertIsArray($response['body']['buildsFailed']); + $this->assertIsArray($response['body']['requests']); + $this->assertIsArray($response['body']['inbound']); + $this->assertIsArray($response['body']['outbound']); + $this->assertEquals($executions, $response['body']['executions'][array_key_last($response['body']['executions'])]['value']); + $this->validateDates($response['body']['executions']); + $this->assertEquals($executionTime, $response['body']['executionsTime'][array_key_last($response['body']['executionsTime'])]['value']); + $this->validateDates($response['body']['executionsTime']); + $this->assertGreaterThan(0, $response['body']['buildsTime'][array_key_last($response['body']['buildsTime'])]['value']); + $this->validateDates($response['body']['buildsTime']); + } + /** @depends testFunctionsStats */ public function testCustomDomainsFunctionStats(array $data): void { @@ -835,22 +1013,24 @@ class UsageTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); - $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => [ - Query::equal('resourceId', [$functionId])->toString(), - Query::equal('resourceType', ['function'])->toString(), + $rule = $this->client->call( + Client::METHOD_POST, + '/proxy/rules/function', + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), + [ + 'domain' => 'test-' . ID::unique() . System::getEnv('_APP_DOMAIN_FUNCTIONS'), + 'functionId' => $functionId, ], - ]); + ); - $this->assertEquals(200, $rules['headers']['status-code']); - $this->assertEquals(1, $rules['body']['total']); - $this->assertCount(1, $rules['body']['rules']); - $this->assertNotEmpty($rules['body']['rules'][0]['domain']); + $this->assertEquals(201, $rule['headers']['status-code']); + $this->assertNotEmpty($rule['body']['$id']); + $this->assertNotEmpty($rule['body']['domain']); - $domain = $rules['body']['rules'][0]['domain']; + $domain = $rule['body']['domain']; $response = $this->client->call( Client::METHOD_GET, @@ -859,7 +1039,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(19, count($response['body'])); + $this->assertEquals(24, count($response['body'])); $this->assertEquals('30d', $response['body']['range']); $functionsMetrics = $response['body']; @@ -901,7 +1081,7 @@ class UsageTest extends Scope ); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(19, count($response['body'])); + $this->assertEquals(24, count($response['body'])); $this->assertEquals('30d', $response['body']['range']); // Check if the new values are greater than the old values diff --git a/tests/e2e/Scopes/ProjectCustom.php b/tests/e2e/Scopes/ProjectCustom.php index 533fccd87d..a354696f53 100644 --- a/tests/e2e/Scopes/ProjectCustom.php +++ b/tests/e2e/Scopes/ProjectCustom.php @@ -3,6 +3,7 @@ namespace Tests\E2E\Scopes; use Tests\E2E\Client; +use Utopia\Database\DateTime; use Utopia\Database\Helpers\ID; use Utopia\System\System; @@ -75,10 +76,16 @@ trait ProjectCustom 'files.write', 'buckets.read', 'buckets.write', + 'sites.read', + 'sites.write', 'functions.read', 'functions.write', + 'sites.read', + 'sites.write', 'execution.read', 'execution.write', + 'log.read', + 'log.write', 'locale.read', 'avatars.read', 'health.read', @@ -96,7 +103,9 @@ trait ProjectCustom 'subscribers.write', 'subscribers.read', 'migrations.write', - 'migrations.read' + 'migrations.read', + 'tokens.read', + 'tokens.write', ], ]); @@ -104,6 +113,19 @@ trait ProjectCustom $this->assertNotEmpty($key['body']); $this->assertNotEmpty($key['body']['secret']); + $devKey = $this->client->call(Client::METHOD_POST, '/projects/' . $project['body']['$id'] . '/dev-keys', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + 'x-appwrite-project' => 'console', + ], [ + 'name' => 'Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 3600), + ]); + $this->assertEquals(201, $devKey['headers']['status-code']); + $this->assertNotEmpty($devKey['body']); + $this->assertNotEmpty($devKey['body']['secret']); + $webhook = $this->client->call(Client::METHOD_POST, '/projects/' . $project['body']['$id'] . '/webhooks', [ 'origin' => 'http://localhost', 'content-type' => 'application/json', @@ -144,9 +166,11 @@ trait ProjectCustom '$id' => $project['body']['$id'], 'name' => $project['body']['name'], 'apiKey' => $key['body']['secret'], + 'devKey' => $devKey['body']['secret'], 'webhookId' => $webhook['body']['$id'], 'signatureKey' => $webhook['body']['signatureKey'], ]; + if ($fresh) { return $project; } diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index 3213ff4c5d..6deaa62c05 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -56,7 +56,7 @@ abstract class Scope extends TestCase /** * @return array */ - abstract public function getHeaders(): array; + abstract public function getHeaders(bool $devKey = true): array; /** * @return array diff --git a/tests/e2e/Scopes/SideClient.php b/tests/e2e/Scopes/SideClient.php index 54f77a9747..17ee7a3002 100644 --- a/tests/e2e/Scopes/SideClient.php +++ b/tests/e2e/Scopes/SideClient.php @@ -4,12 +4,17 @@ namespace Tests\E2E\Scopes; trait SideClient { - public function getHeaders(): array + public function getHeaders(bool $devKey = true): array { - return [ + $headers = [ 'origin' => 'http://localhost', 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $this->getUser()['session'], + ]; + if ($devKey && isset($this->getProject()['devKey'])) { + $headers['x-appwrite-dev-key'] = $this->getProject()['devKey']; + } + return $headers; } /** diff --git a/tests/e2e/Scopes/SideConsole.php b/tests/e2e/Scopes/SideConsole.php index 74a0dd0c60..9ad3e93d6a 100644 --- a/tests/e2e/Scopes/SideConsole.php +++ b/tests/e2e/Scopes/SideConsole.php @@ -4,7 +4,7 @@ namespace Tests\E2E\Scopes; trait SideConsole { - public function getHeaders(): array + public function getHeaders(bool $devKey = true): array { return [ 'origin' => 'http://localhost', diff --git a/tests/e2e/Scopes/SideNone.php b/tests/e2e/Scopes/SideNone.php index 79c52afe00..1660beb777 100644 --- a/tests/e2e/Scopes/SideNone.php +++ b/tests/e2e/Scopes/SideNone.php @@ -4,7 +4,7 @@ namespace Tests\E2E\Scopes; trait SideNone { - public function getHeaders(): array + public function getHeaders(bool $devKey = true): array { return []; } diff --git a/tests/e2e/Scopes/SideServer.php b/tests/e2e/Scopes/SideServer.php index b5e15150e9..d27b2092b0 100644 --- a/tests/e2e/Scopes/SideServer.php +++ b/tests/e2e/Scopes/SideServer.php @@ -9,7 +9,7 @@ trait SideServer */ protected $key = []; - public function getHeaders(): array + public function getHeaders(bool $devKey = false): array { return [ 'x-appwrite-key' => $this->getProject()['apiKey'] diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index 2d72625121..1a77cccb18 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -99,6 +99,7 @@ trait AccountBase 'origin' => 'http://localhost', 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-dev-key' => $this->getProject()['devKey'] ?? '', ]), [ 'userId' => ID::unique(), 'email' => '', @@ -112,13 +113,14 @@ trait AccountBase 'origin' => 'http://localhost', 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-dev-key' => $this->getProject()['devKey'] ?? '' ]), [ 'userId' => ID::unique(), 'email' => 'shortpass@appwrite.io', 'password' => $shortPassword ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); $longPassword = ''; for ($i = 0; $i < 257; $i++) { // 256 is the limit @@ -129,13 +131,14 @@ trait AccountBase 'origin' => 'http://localhost', 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-dev-key' => $this->getProject()['devKey'] ?? '' ]), [ 'userId' => ID::unique(), 'email' => 'longpass@appwrite.io', 'password' => $longPassword, ]); - $this->assertEquals($response['headers']['status-code'], 400); + $this->assertEquals(400, $response['headers']['status-code']); return [ 'id' => $id, @@ -156,7 +159,7 @@ trait AccountBase 'email' => 'otpuser@appwrite.io' ]); - $this->assertEquals($response['headers']['status-code'], 201); + $this->assertEquals(201, $response['headers']['status-code'], ); $this->assertNotEmpty($response['body']['$id']); $this->assertNotEmpty($response['body']['$createdAt']); $this->assertNotEmpty($response['body']['userId']); @@ -286,6 +289,7 @@ trait AccountBase 'origin' => 'http://localhost', 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-dev-key' => $this->getProject()['devKey'] ?? '' ]), [ 'userId' => ID::unique(), 'email' => $email, diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index daa5bcbff8..452b725c11 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -619,6 +619,7 @@ class AccountCustomClientTest extends Scope 'origin' => 'http://localhost', 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-dev-key' => $this->getProject()['devKey'] ?? '' ]), [ 'userId' => ID::unique(), 'email' => $data['email'], @@ -1217,6 +1218,7 @@ class AccountCustomClientTest extends Scope 'origin' => 'http://localhost', 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-dev-key' => $this->getProject()['devKey'] ?? '' ]), [ 'userId' => ID::unique(), 'email' => $email, diff --git a/tests/e2e/Services/Console/ConsoleConsoleClientTest.php b/tests/e2e/Services/Console/ConsoleConsoleClientTest.php index ca9287cdca..6059cb2000 100644 --- a/tests/e2e/Services/Console/ConsoleConsoleClientTest.php +++ b/tests/e2e/Services/Console/ConsoleConsoleClientTest.php @@ -24,13 +24,19 @@ class ConsoleConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertCount(7, $response['body']); - $this->assertIsString($response['body']['_APP_DOMAIN_TARGET']); + $this->assertCount(13, $response['body']); + $this->assertIsString($response['body']['_APP_DOMAIN_TARGET_CNAME']); + $this->assertIsString($response['body']['_APP_DOMAIN_TARGET_A']); + $this->assertIsString($response['body']['_APP_DOMAIN_TARGET_AAAA']); $this->assertIsInt($response['body']['_APP_STORAGE_LIMIT']); - $this->assertIsInt($response['body']['_APP_FUNCTIONS_SIZE_LIMIT']); - $this->assertIsString($response['body']['_APP_DOMAIN_TARGET']); + $this->assertIsInt($response['body']['_APP_COMPUTE_SIZE_LIMIT']); $this->assertIsBool($response['body']['_APP_DOMAIN_ENABLED']); $this->assertIsBool($response['body']['_APP_VCS_ENABLED']); $this->assertIsBool($response['body']['_APP_ASSISTANT_ENABLED']); + $this->assertIsString($response['body']['_APP_DOMAIN_SITES']); + $this->assertIsString($response['body']['_APP_DOMAIN_FUNCTIONS']); + $this->assertIsString($response['body']['_APP_OPTIONS_FORCE_HTTPS']); + $this->assertIsString($response['body']['_APP_DOMAINS_NAMESERVERS']); + // When adding new keys, dont forget to update count a few lines above } } diff --git a/tests/e2e/Services/Databases/DatabasesPermissionsScope.php b/tests/e2e/Services/Databases/DatabasesPermissionsScope.php index 336e47db08..0042d253ac 100644 --- a/tests/e2e/Services/Databases/DatabasesPermissionsScope.php +++ b/tests/e2e/Services/Databases/DatabasesPermissionsScope.php @@ -15,6 +15,7 @@ trait DatabasesPermissionsScope 'origin' => 'http://localhost', 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-dev-key' => $this->getProject()['devKey'] ?? '', ], [ 'userId' => $id, 'email' => $email, diff --git a/tests/e2e/Services/Functions/FunctionsBase.php b/tests/e2e/Services/Functions/FunctionsBase.php index a1bb8f2b21..475eb9b9b4 100644 --- a/tests/e2e/Services/Functions/FunctionsBase.php +++ b/tests/e2e/Services/Functions/FunctionsBase.php @@ -6,6 +6,9 @@ use Appwrite\Tests\Async; use CURLFile; use Tests\E2E\Client; use Utopia\CLI\Console; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Query; +use Utopia\System\System; trait FunctionsBase { @@ -48,6 +51,18 @@ trait FunctionsBase $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); }, 50000, 500); + // Not === so multipart/form-data works fine too + if (($params['activate'] ?? false) == true) { + $this->assertEventually(function () use ($functionId, $deploymentId) { + $function = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ])); + $this->assertEquals($deploymentId, $function['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + } + return $deploymentId; } @@ -72,6 +87,16 @@ trait FunctionsBase return $function; } + protected function updateFunction(string $functionId, mixed $params): mixed + { + $function = $this->client->call(Client::METHOD_PUT, '/functions/' . $functionId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $function; + } + protected function createVariable(string $functionId, mixed $params): mixed { $variable = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/variables', array_merge([ @@ -82,6 +107,46 @@ trait FunctionsBase return $variable; } + protected function getVariable(string $functionId, string $variableId): mixed + { + $variable = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/variables/' . $variableId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $variable; + } + + protected function updateVariable(string $functionId, string $variableId, mixed $params): mixed + { + $variable = $this->client->call(Client::METHOD_PUT, '/functions/' . $functionId . '/variables/' . $variableId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $variable; + } + + protected function listVariables(string $functionId, mixed $params = []): mixed + { + $variables = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/variables', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $variables; + } + + protected function deleteVariable(string $functionId, string $variableId): mixed + { + $variable = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId . '/variables/' . $variableId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $variable; + } + protected function getFunction(string $functionId): mixed { $function = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId, array_merge([ @@ -166,7 +231,27 @@ trait FunctionsBase return $deployment; } - protected function getFunctionUsage(string $functionId, mixed $params): mixed + protected function deleteDeployment(string $functionId, string $deploymentId): mixed + { + $deployment = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId . '/deployments/' . $deploymentId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + return $deployment; + } + + protected function createTemplateDeployment(string $functionId, mixed $params = []): mixed + { + $deployment = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/deployments/template', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $deployment; + } + + protected function getUsage(string $functionId, mixed $params): mixed { $usage = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/usage', array_merge([ 'content-type' => 'application/json', @@ -181,7 +266,7 @@ trait FunctionsBase $template = $this->client->call(Client::METHOD_GET, '/functions/templates/' . $templateId, array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ])); return $template; } @@ -205,4 +290,123 @@ trait FunctionsBase return $function; } + + protected function setupFunctionDomain(string $functionId, string $subdomain = ''): string + { + $subdomain = $subdomain ? $subdomain : ID::unique(); + $rule = $this->client->call(Client::METHOD_POST, '/proxy/rules/function', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'domain' => $subdomain . '.' . System::getEnv('_APP_DOMAIN_FUNCTIONS', ''), + 'functionId' => $functionId, + ]); + + $this->assertEquals(201, $rule['headers']['status-code']); + $this->assertNotEmpty($rule['body']['$id']); + $this->assertNotEmpty($rule['body']['domain']); + + $domain = $rule['body']['domain']; + + return $domain; + } + + protected function getFunctionDomain(string $functionId): string + { + $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('deploymentResourceId', [$functionId])->toString(), + Query::equal('trigger', ['manual'])->toString(), + Query::equal('type', ['deployment'])->toString(), + ], + ]); + + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertGreaterThanOrEqual(1, $rules['body']['total']); + $this->assertGreaterThanOrEqual(1, \count($rules['body']['rules'])); + $this->assertNotEmpty($rules['body']['rules'][0]['domain']); + + $domain = $rules['body']['rules'][0]['domain']; + + return $domain; + } + + protected function getDeploymentDownload(string $functionId, string $deploymentId, string $type): mixed + { + $response = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId . '/deployments/' . $deploymentId . '/download', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'type' => $type + ]); + + return $response; + } + + protected function setupDuplicateDeployment(string $functionId, string $deploymentId): string + { + $deployment = $this->createDuplicateDeployment($functionId, $deploymentId); + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId); + + $this->assertEventually(function () use ($functionId, $deploymentId) { + $deployment = $this->getDeployment($functionId, $deploymentId); + $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + $this->assertEventually(function () use ($functionId, $deploymentId) { + $function = $this->getFunction($functionId); + $this->assertEquals($deploymentId, $function['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + return $deploymentId; + } + + protected function createDuplicateDeployment(string $functionId, string $deploymentId): mixed + { + $deployment = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/deployments/duplicate', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'deploymentId' => $deploymentId, + ]); + + return $deployment; + } + + protected function updateFunctionDeployment(string $functionId, string $deploymentId): mixed + { + $function = $this->client->call(Client::METHOD_PATCH, '/functions/' . $functionId . '/deployment', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'deploymentId' => $deploymentId + ]); + + return $function; + } + + protected function cancelDeployment(string $functionId, string $deploymentId): mixed + { + $deployment = $this->client->call(Client::METHOD_PATCH, '/functions/' . $functionId . '/deployments/' . $deploymentId . '/status', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $deployment; + } + + protected function listSpecifications(): mixed + { + $specifications = $this->client->call(Client::METHOD_GET, '/functions/specifications', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $specifications; + } } diff --git a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php index 3a02cbcba2..24215f5352 100644 --- a/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsConsoleClientTest.php @@ -58,11 +58,11 @@ class FunctionsConsoleClientTest extends Scope /** * Test for SUCCESS */ - $usage = $this->getFunctionUsage($data['functionId'], [ + $usage = $this->getUsage($data['functionId'], [ 'range' => '24h' ]); $this->assertEquals(200, $usage['headers']['status-code']); - $this->assertEquals(19, count($usage['body'])); + $this->assertEquals(24, count($usage['body'])); $this->assertEquals('24h', $usage['body']['range']); $this->assertIsNumeric($usage['body']['deploymentsTotal']); $this->assertIsNumeric($usage['body']['deploymentsStorageTotal']); @@ -87,12 +87,12 @@ class FunctionsConsoleClientTest extends Scope /** * Test for FAILURE */ - $usage = $this->getFunctionUsage($data['functionId'], [ + $usage = $this->getUsage($data['functionId'], [ 'range' => '232h' ]); $this->assertEquals(400, $usage['headers']['status-code']); - $usage = $this->getFunctionUsage('randomFunctionId', [ + $usage = $this->getUsage('randomFunctionId', [ 'range' => '24h' ]); $this->assertEquals(404, $usage['headers']['status-code']); @@ -110,7 +110,8 @@ class FunctionsConsoleClientTest extends Scope $data['functionId'], [ 'key' => 'APP_TEST', - 'value' => 'TESTINGVALUE' + 'value' => 'TESTINGVALUE', + 'secret' => false ] ); @@ -118,6 +119,23 @@ class FunctionsConsoleClientTest extends Scope $variableId = $variable['body']['$id']; + // test for secret variable + $variable = $this->createVariable( + $data['functionId'], + [ + 'key' => 'APP_TEST_1', + 'value' => 'TESTINGVALUE_1', + 'secret' => true + ] + ); + + $this->assertEquals(201, $variable['headers']['status-code']); + $this->assertEquals('APP_TEST_1', $variable['body']['key']); + $this->assertEmpty($variable['body']['value']); + $this->assertTrue($variable['body']['secret']); + + $secretVariableId = $variable['body']['$id']; + /** * Test for FAILURE */ @@ -126,7 +144,8 @@ class FunctionsConsoleClientTest extends Scope $data['functionId'], [ 'key' => 'APP_TEST', - 'value' => 'ANOTHERTESTINGVALUE' + 'value' => 'ANOTHERTESTINGVALUE', + 'secret' => false ] ); @@ -157,7 +176,8 @@ class FunctionsConsoleClientTest extends Scope return array_merge( $data, [ - 'variableId' => $variableId + 'variableId' => $variableId, + 'secretVariableId' => $secretVariableId ] ); } @@ -177,10 +197,12 @@ class FunctionsConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(1, sizeof($response['body']['variables'])); - $this->assertEquals(1, $response['body']['total']); + $this->assertEquals(2, sizeof($response['body']['variables'])); + $this->assertEquals(2, $response['body']['total']); $this->assertEquals("APP_TEST", $response['body']['variables'][0]['key']); $this->assertEquals("TESTINGVALUE", $response['body']['variables'][0]['value']); + $this->assertEquals("APP_TEST_1", $response['body']['variables'][1]['key']); + $this->assertEmpty($response['body']['variables'][1]['value']); /** * Test for FAILURE @@ -207,6 +229,15 @@ class FunctionsConsoleClientTest extends Scope $this->assertEquals("APP_TEST", $response['body']['key']); $this->assertEquals("TESTINGVALUE", $response['body']['value']); + $response = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/variables/' . $data['secretVariableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals("APP_TEST_1", $response['body']['key']); + $this->assertEmpty($response['body']['value']); + /** * Test for FAILURE */ @@ -251,6 +282,27 @@ class FunctionsConsoleClientTest extends Scope $this->assertEquals("APP_TEST_UPDATE", $variable['body']['key']); $this->assertEquals("TESTINGVALUEUPDATED", $variable['body']['value']); + $response = $this->client->call(Client::METHOD_PUT, '/functions/' . $data['functionId'] . '/variables/' . $data['secretVariableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'key' => 'APP_TEST_UPDATE_1', + 'value' => 'TESTINGVALUEUPDATED_1' + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals("APP_TEST_UPDATE_1", $response['body']['key']); + $this->assertEmpty($response['body']['value']); + + $variable = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/variables/' . $data['secretVariableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $variable['headers']['status-code']); + $this->assertEquals("APP_TEST_UPDATE_1", $variable['body']['key']); + $this->assertEmpty($variable['body']['value']); + $response = $this->client->call(Client::METHOD_PUT, '/functions/' . $data['functionId'] . '/variables/' . $data['variableId'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -271,6 +323,41 @@ class FunctionsConsoleClientTest extends Scope $this->assertEquals("APP_TEST_UPDATE_2", $variable['body']['key']); $this->assertEquals("TESTINGVALUEUPDATED", $variable['body']['value']); + // convert non-secret variable to secret + $response = $this->client->call(Client::METHOD_PUT, '/functions/' . $data['functionId'] . '/variables/' . $data['variableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'key' => 'APP_TEST_UPDATE_2', + 'secret' => true + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals("APP_TEST_UPDATE_2", $response['body']['key']); + $this->assertEmpty($response['body']['value']); + $this->assertTrue($response['body']['secret']); + + $variable = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/variables/' . $data['variableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $variable['headers']['status-code']); + $this->assertEquals("APP_TEST_UPDATE_2", $variable['body']['key']); + $this->assertEmpty($variable['body']['value']); + $this->assertTrue($variable['body']['secret']); + + // convert secret variable to non-secret + $response = $this->client->call(Client::METHOD_PUT, '/functions/' . $data['functionId'] . '/variables/' . $data['variableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'key' => 'APP_TEST_UPDATE', + 'secret' => false + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + /** * Test for FAILURE */ @@ -332,6 +419,13 @@ class FunctionsConsoleClientTest extends Scope $this->assertEquals(204, $response['headers']['status-code']); + $response = $this->client->call(Client::METHOD_DELETE, '/functions/' . $data['functionId'] . '/variables/' . $data['secretVariableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(204, $response['headers']['status-code']); + $response = $this->client->call(Client::METHOD_GET, '/functions/' . $data['functionId'] . '/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -354,4 +448,93 @@ class FunctionsConsoleClientTest extends Scope return $data; } + + public function testVariableE2E(): void + { + $function = $this->createFunction([ + 'functionId' => ID::unique(), + 'runtime' => 'node-18.0', + 'name' => 'Variable E2E Test', + 'entrypoint' => 'index.js', + 'logging' => false, + 'execute' => ['any'] + ]); + + $this->assertEquals(201, $function['headers']['status-code']); + $this->assertFalse($function['body']['logging']); + $this->assertNotEmpty($function['body']['$id']); + + $functionId = $function['body']['$id'] ?? ''; + + // create variable + $variable = $this->createVariable($functionId, [ + 'key' => 'CUSTOM_VARIABLE', + 'value' => 'a_secret_value', + 'secret' => true, + ]); + + $this->assertEquals(201, $variable['headers']['status-code']); + $this->assertNotEmpty($variable['body']['$id']); + $this->assertEquals('CUSTOM_VARIABLE', $variable['body']['key']); + $this->assertEquals('', $variable['body']['value']); + $this->assertEquals(true, $variable['body']['secret']); + + $deploymentId = $this->setupDeployment($functionId, [ + 'entrypoint' => 'index.js', + 'code' => $this->packageFunction('node'), + 'activate' => true + ]); + + $this->assertNotEmpty($deploymentId); + + $execution = $this->createExecution($functionId); + + $this->assertEquals(201, $execution['headers']['status-code']); + $this->assertEmpty($execution['body']['logs']); + $this->assertEmpty($execution['body']['errors']); + $body = json_decode($execution['body']['responseBody']); + $this->assertEquals('a_secret_value', $body->CUSTOM_VARIABLE); + + $this->cleanupFunction($functionId); + } + + public function testFunctionDownload(): void + { + $functionId = $this->setupFunction([ + 'functionId' => ID::unique(), + 'runtime' => 'node-18.0', + 'name' => 'Download Test', + 'entrypoint' => 'index.js', + 'logging' => false, + 'execute' => ['any'] + ]); + + $deploymentId = $this->setupDeployment($functionId, [ + 'entrypoint' => 'index.js', + 'code' => $this->packageFunction('node'), + 'activate' => true + ]); + + $this->assertNotEmpty($deploymentId); + + $response = $this->getDeploymentDownload($functionId, $deploymentId, 'source'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('application/gzip', $response['headers']['content-type']); + $this->assertGreaterThan(0, $response['headers']['content-length']); + $this->assertGreaterThan(0, \strlen($response['body'])); + + $deploymentMd5 = \md5($response['body']); + + $response = $this->getDeploymentDownload($functionId, $deploymentId, 'output'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('application/gzip', $response['headers']['content-type']); + $this->assertGreaterThan(0, $response['headers']['content-length']); + $this->assertGreaterThan(0, \strlen($response['body'])); + + $buildMd5 = \md5($response['body']); + + $this->assertNotEquals($deploymentMd5, $buildMd5); + + $this->cleanupFunction($functionId); + } } diff --git a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php index 55db081720..a47bc62d47 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomClientTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomClientTest.php @@ -75,8 +75,6 @@ class FunctionsCustomClientTest extends Scope $this->cleanupFunction($functionId); } - - public function testCreateCustomExecution(): array { /** @@ -278,6 +276,7 @@ class FunctionsCustomClientTest extends Scope // List all templates $templates = $this->client->call(Client::METHOD_GET, '/functions/templates', array_merge([ 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); $this->assertEquals(200, $templates['headers']['status-code']); @@ -298,17 +297,19 @@ class FunctionsCustomClientTest extends Scope // List templates with pagination $templatesOffset = $this->client->call(Client::METHOD_GET, '/functions/templates', array_merge([ 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'limit' => 1, 'offset' => 2 ]); $this->assertEquals(200, $templatesOffset['headers']['status-code']); - $this->assertEquals(1, $templatesOffset['body']['total']); + $this->addToAssertionCount(1, $templatesOffset['body']['templates']); $this->assertEquals($templates['body']['templates'][2]['id'], $templatesOffset['body']['templates'][0]['id']); // List templates with filters $templates = $this->client->call(Client::METHOD_GET, '/functions/templates', array_merge([ 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'useCases' => ['starter', 'ai'], 'runtimes' => ['bun-1.0', 'dart-2.16'] @@ -320,7 +321,16 @@ class FunctionsCustomClientTest extends Scope $this->assertContains($template['useCases'][0], ['starter', 'ai']); } $this->assertArrayHasKey('runtimes', $templates['body']['templates'][0]); - $this->assertContains('bun-1.0', array_column($templates['body']['templates'][0]['runtimes'], 'name')); + + foreach ($templates['body']['templates'] as $template) { + $this->assertThat( + \array_column($template['runtimes'], 'name'), + $this->logicalOr( + $this->containsEqual('bun-1.0'), + $this->containsEqual('dart-2.16'), + ), + ); + } // List templates with pagination and filters $templates = $this->client->call(Client::METHOD_GET, '/functions/templates', array_merge([ @@ -334,7 +344,7 @@ class FunctionsCustomClientTest extends Scope ]); $this->assertEquals(200, $templates['headers']['status-code']); - $this->assertEquals(5, $templates['body']['total']); + $this->assertCount(5, $templates['body']['templates']); $this->assertIsArray($templates['body']['templates']); $this->assertArrayHasKey('runtimes', $templates['body']['templates'][0]); @@ -350,6 +360,7 @@ class FunctionsCustomClientTest extends Scope // List templates with invalid limit $templates = $this->client->call(Client::METHOD_GET, '/functions/templates', array_merge([ 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ 'limit' => 5001, 'offset' => 10, diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 182e6902a3..6a8db0a88c 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -2,7 +2,8 @@ namespace Tests\E2E\Services\Functions; -use Appwrite\Functions\Specification; +use Appwrite\Platform\Modules\Compute\Specification; +use Appwrite\Tests\Retry; use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; @@ -20,6 +21,41 @@ class FunctionsCustomServerTest extends Scope use ProjectCustom; use SideServer; + public function testListSpecs(): void + { + $specifications = $this->listSpecifications(); + $this->assertEquals(200, $specifications['headers']['status-code']); + $this->assertGreaterThan(0, $specifications['body']['total']); + $this->assertArrayHasKey(0, $specifications['body']['specifications']); + $this->assertArrayHasKey('memory', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('slug', $specifications['body']['specifications'][0]); + + $function = $this->createFunction([ + 'functionId' => ID::unique(), + 'name' => 'Specs function', + 'runtime' => 'php-8.0', + 'specification' => $specifications['body']['specifications'][0]['slug'] + ]); + $this->assertEquals(201, $function['headers']['status-code']); + $this->assertEquals($specifications['body']['specifications'][0]['slug'], $function['body']['specification']); + + $function = $this->getFunction($function['body']['$id']); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals($specifications['body']['specifications'][0]['slug'], $function['body']['specification']); + + $this->cleanupFunction($function['body']['$id']); + + $function = $this->createFunction([ + 'functionId' => ID::unique(), + 'name' => 'Specs function', + 'runtime' => 'php-8.0', + 'specification' => 'cheap-please' + ]); + $this->assertEquals(400, $function['headers']['status-code']); + } + public function testCreateFunction(): array { /** @@ -37,7 +73,7 @@ class FunctionsCustomServerTest extends Scope 'timeout' => 10, ]); - $functionId = $functionId = $function['body']['$id'] ?? ''; + $functionId = $function['body']['$id'] ?? ''; $dateValidator = new DatetimeValidator(); $this->assertEquals(201, $function['headers']['status-code']); @@ -46,7 +82,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('php-8.0', $function['body']['runtime']); $this->assertEquals(true, $dateValidator->isValid($function['body']['$createdAt'])); $this->assertEquals(true, $dateValidator->isValid($function['body']['$updatedAt'])); - $this->assertEquals('', $function['body']['deployment']); + $this->assertEquals('', $function['body']['deploymentId']); $this->assertEquals([ 'buckets.*.create', 'buckets.*.delete', @@ -261,7 +297,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('Test1', $function['body']['name']); $this->assertEquals(true, $dateValidator->isValid($function['body']['$createdAt'])); $this->assertEquals(true, $dateValidator->isValid($function['body']['$updatedAt'])); - $this->assertEquals('', $function['body']['deployment']); + $this->assertEquals('', $function['body']['deploymentId']); $this->assertEquals([ 'users.*.update.name', 'users.*.update.email', @@ -355,7 +391,28 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(201, $function['headers']['status-code']); $this->assertNotEmpty($function['body']['$id']); - $functionId = $functionId = $function['body']['$id'] ?? ''; + $functionId = $function['body']['$id'] ?? ''; + + $deployment = $this->createTemplateDeployment( + $functionId, + [ + 'resourceId' => ID::unique(), + 'activate' => true, + 'repository' => $starterTemplate['body']['providerRepositoryId'], + 'owner' => $starterTemplate['body']['providerOwner'], + 'rootDirectory' => $phpRuntime['providerRootDirectory'], + 'version' => $starterTemplate['body']['providerVersion'], + ] + ); + + $this->assertEquals(202, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['$id']); + + $deployment = $this->getDeployment($functionId, $deployment['body']['$id']); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertEquals(0, $deployment['body']['sourceSize']); + $this->assertEquals(0, $deployment['body']['buildSize']); + $this->assertEquals(0, $deployment['body']['totalSize']); $deployments = $this->listDeployments($functionId); @@ -365,7 +422,7 @@ class FunctionsCustomServerTest extends Scope $lastDeployment = $deployments['body']['deployments'][0]; $this->assertNotEmpty($lastDeployment['$id']); - $this->assertEquals(0, $lastDeployment['size']); + $this->assertEquals(0, $lastDeployment['sourceSize']); $deploymentId = $lastDeployment['$id']; @@ -379,7 +436,7 @@ class FunctionsCustomServerTest extends Scope $function = $this->getFunction($functionId); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertEquals($deploymentId, $function['body']['deployment']); + $this->assertEquals($deploymentId, $function['body']['deploymentId']); // Test starter code is used and that dynamic keys work $execution = $this->createExecution($functionId, [ @@ -429,7 +486,21 @@ class FunctionsCustomServerTest extends Scope $this->assertStringContainsString("Total users: " . $totalUsers, $execution['body']['logs']); }, 10000, 500); - $function = $this->deleteFunction($functionId); + $deployment = $this->getDeployment($functionId, $deployment['body']['$id']); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['sourceSize']); + $this->assertGreaterThan(0, $deployment['body']['buildSize']); + $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; + $this->assertEquals($totalSize, $deployment['body']['totalSize']); + + $function = $this->getFunction($functionId); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertNotEmpty($function['body']['deploymentId']); + $this->assertNotEmpty($function['body']['deploymentCreatedAt']); + $this->assertEquals($deployment['body']['$id'], $function['body']['deploymentId']); + $this->assertEquals($deployment['body']['$createdAt'], $function['body']['deploymentCreatedAt']); + + $function = $this->cleanupFunction($functionId); } /** @@ -449,6 +520,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); $this->assertNotEmpty($deployment['body']['$id']); + $this->assertEquals('waiting', $deployment['body']['status']); $this->assertEquals(true, (new DatetimeValidator())->isValid($deployment['body']['$createdAt'])); $this->assertEquals('index.php', $deployment['body']['entrypoint']); @@ -479,8 +551,8 @@ class FunctionsCustomServerTest extends Scope $function = $this->getFunction($functionId); $this->assertEquals(200, $function['headers']['status-code']); - $this->assertEquals($deploymentIdActive, $function['body']['deployment']); - $this->assertNotEquals($deploymentIdInactive, $function['body']['deployment']); + $this->assertEquals($deploymentIdActive, $function['body']['deploymentId']); + $this->assertNotEquals($deploymentIdInactive, $function['body']['deploymentId']); $deployment = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId . '/deployments/' . $deploymentIdInactive, array_merge([ 'content-type' => 'application/json', @@ -495,6 +567,7 @@ class FunctionsCustomServerTest extends Scope /** * @depends testUpdateFunction */ + #[Retry(count: 3)] public function testCancelDeploymentBuild($data): void { $functionId = $data['functionId']; @@ -518,14 +591,9 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals('building', $deployment['body']['status']); }, 100000, 250); - // Cancel the deployment - $cancel = $this->client->call(Client::METHOD_PATCH, '/functions/' . $functionId . '/deployments/' . $deploymentId . '/build', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); - - $this->assertEquals(200, $cancel['headers']['status-code']); - $this->assertEquals('canceled', $cancel['body']['status']); + $deployment = $this->cancelDeployment($functionId, $deploymentId); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertEquals('canceled', $deployment['body']['status']); /** * Build worker still runs the build. @@ -585,10 +653,10 @@ class FunctionsCustomServerTest extends Scope $this->assertNotEmpty($largeTag['body']['$id']); $this->assertEquals(true, (new DatetimeValidator())->isValid($largeTag['body']['$createdAt'])); $this->assertEquals('index.php', $largeTag['body']['entrypoint']); - $this->assertGreaterThan(1024 * 1024 * 5, $largeTag['body']['size']); // ~7MB video file - $this->assertLessThan(1024 * 1024 * 10, $largeTag['body']['size']); // ~7MB video file + $this->assertGreaterThan(1024 * 1024 * 5, $largeTag['body']['sourceSize']); // ~7MB video file + $this->assertLessThan(1024 * 1024 * 10, $largeTag['body']['sourceSize']); // ~7MB video file - $deploymentSize = $largeTag['body']['size']; + $deploymentSize = $largeTag['body']['sourceSize']; $deploymentId = $largeTag['body']['$id']; $this->assertEventually(function () use ($functionId, $deploymentId, $deploymentSize) { @@ -596,7 +664,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(200, $deployment['headers']['status-code']); $this->assertEquals('ready', $deployment['body']['status']); - $this->assertEquals($deploymentSize, $deployment['body']['size']); + $this->assertEquals($deploymentSize, $deployment['body']['sourceSize']); $this->assertGreaterThan(1024 * 1024 * 10, $deployment['body']['buildSize']); // ~7MB video file + 10MB sample file }, 500000, 1000); @@ -622,7 +690,7 @@ class FunctionsCustomServerTest extends Scope $this->assertNotEmpty($response['body']['$id']); $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); $this->assertEquals(true, $dateValidator->isValid($response['body']['$updatedAt'])); - $this->assertEquals($data['deploymentId'], $response['body']['deployment']); + $this->assertEquals($data['deploymentId'], $response['body']['deploymentId']); return $data; } @@ -642,7 +710,7 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals($deployments['body']['total'], 3); $this->assertIsArray($deployments['body']['deployments']); $this->assertCount(3, $deployments['body']['deployments']); - $this->assertArrayHasKey('size', $deployments['body']['deployments'][0]); + $this->assertArrayHasKey('sourceSize', $deployments['body']['deployments'][0]); $this->assertArrayHasKey('buildSize', $deployments['body']['deployments'][0]); $deployments = $this->listDeployments($functionId, [ @@ -660,36 +728,13 @@ class FunctionsCustomServerTest extends Scope ], ]); - $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertCount(2, $deployments['body']['deployments']); - $deployments = $this->listDeployments($functionId, [ - 'queries' => [ - Query::equal('entrypoint', ['index.php'])->toString(), - ], - ]); + $deployments = $this->listDeployments($functionId); - $this->assertEquals($deployments['headers']['status-code'], 200); - $this->assertCount(3, $deployments['body']['deployments']); - - $deployments = $this->listDeployments($functionId, [ - 'queries' => [ - Query::equal('entrypoint', ['index.js'])->toString(), - ], - ]); - - $this->assertEquals($deployments['headers']['status-code'], 200); - $this->assertCount(0, $deployments['body']['deployments']); - - $deployments = $this->listDeployments($functionId, [ - 'search' => 'php-8.0' - ]); - - $this->assertEquals($deployments['headers']['status-code'], 200); - $this->assertEquals(3, $deployments['body']['total']); $this->assertIsArray($deployments['body']['deployments']); - $this->assertCount(3, $deployments['body']['deployments']); - $this->assertEquals($deployments['body']['deployments'][0]['$id'], $data['deploymentId']); + $this->assertEquals(200, $deployments['headers']['status-code']); $deployments = $this->listDeployments( $functionId, @@ -731,7 +776,7 @@ class FunctionsCustomServerTest extends Scope $functionId, [ 'queries' => [ - Query::greaterThan('size', 10000)->toString(), + Query::greaterThan('sourceSize', 10000)->toString(), ], ] ); @@ -743,7 +788,7 @@ class FunctionsCustomServerTest extends Scope $functionId, [ 'queries' => [ - Query::greaterThan('size', 0)->toString(), + Query::greaterThan('sourceSize', 0)->toString(), ], ] ); @@ -755,7 +800,7 @@ class FunctionsCustomServerTest extends Scope $functionId, [ 'queries' => [ - Query::greaterThan('size', -100)->toString(), + Query::greaterThan('sourceSize', -100)->toString(), ], ] ); @@ -776,16 +821,16 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals(200, $deployments['headers']['status-code']); $this->assertGreaterThanOrEqual(1, $deployments['body']['total']); $this->assertNotEmpty($deployments['body']['deployments'][0]['$id']); - $this->assertNotEmpty($deployments['body']['deployments'][0]['size']); + $this->assertNotEmpty($deployments['body']['deployments'][0]['sourceSize']); $deploymentId = $deployments['body']['deployments'][0]['$id']; - $deploymentSize = $deployments['body']['deployments'][0]['size']; + $deploymentSize = $deployments['body']['deployments'][0]['sourceSize']; $deployments = $this->listDeployments( $functionId, [ 'queries' => [ - Query::equal('size', [$deploymentSize])->toString(), + Query::equal('sourceSize', [$deploymentSize])->toString(), ], ] ); @@ -802,7 +847,7 @@ class FunctionsCustomServerTest extends Scope if (!empty($matchingDeployment)) { $deployment = reset($matchingDeployment); - $this->assertEquals($deploymentSize, $deployment['size']); + $this->assertEquals($deploymentSize, $deployment['sourceSize']); } return $data; @@ -819,10 +864,10 @@ class FunctionsCustomServerTest extends Scope $deployment = $this->getDeployment($data['functionId'], $data['deploymentId']); $this->assertEquals(200, $deployment['headers']['status-code']); - $this->assertGreaterThan(0, $deployment['body']['buildTime']); + $this->assertGreaterThan(0, $deployment['body']['buildDuration']); $this->assertNotEmpty($deployment['body']['status']); $this->assertNotEmpty($deployment['body']['buildLogs']); - $this->assertArrayHasKey('size', $deployment['body']); + $this->assertArrayHasKey('sourceSize', $deployment['body']); $this->assertArrayHasKey('buildSize', $deployment['body']); /** @@ -1240,7 +1285,7 @@ class FunctionsCustomServerTest extends Scope ['folder' => 'node', 'name' => 'node-18.0', 'entrypoint' => 'index.js', 'runtimeName' => 'Node.js', 'runtimeVersion' => '18.0'], ['folder' => 'python', 'name' => 'python-3.9', 'entrypoint' => 'main.py', 'runtimeName' => 'Python', 'runtimeVersion' => '3.9'], ['folder' => 'ruby', 'name' => 'ruby-3.1', 'entrypoint' => 'main.rb', 'runtimeName' => 'Ruby', 'runtimeVersion' => '3.1'], - // Swift and Dart disabled as it's very slow. + // Swift and Dart disabled on purpose, as it's very slow. // [ 'folder' => 'dart', 'name' => 'dart-2.15', 'entrypoint' => 'main.dart', 'runtimeName' => 'Dart', 'runtimeVersion' => '2.15' ], // [ 'folder' => 'swift', 'name' => 'swift-5.5', 'entrypoint' => 'index.swift', 'runtimeName' => 'Swift', 'runtimeVersion' => '5.5' ], ]; @@ -1464,7 +1509,7 @@ class FunctionsCustomServerTest extends Scope $runtimes = $this->client->call(Client::METHOD_GET, '/functions/runtimes', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ])); $this->assertEquals(200, $runtimes['headers']['status-code']); $this->assertGreaterThan(0, $runtimes['body']['total']); @@ -1540,7 +1585,7 @@ class FunctionsCustomServerTest extends Scope $functionId = $this->setupFunction([ 'functionId' => ID::unique(), 'name' => 'Test PHP Scopes executions', - 'commands' => 'sh setup.sh && composer install', + 'commands' => 'bash setup.sh && composer install', 'runtime' => 'php-8.0', 'entrypoint' => 'index.php', 'scopes' => ['users.read'], @@ -1603,11 +1648,14 @@ class FunctionsCustomServerTest extends Scope 'entrypoint' => 'index.php', 'timeout' => 15, ]); - $this->setupDeployment($functionId, [ + $this->assertNotEmpty($functionId); + + $deploymentId = $this->setupDeployment($functionId, [ 'entrypoint' => 'index.php', 'code' => $this->packageFunction('php-cookie'), 'activate' => true ]); + $this->assertNotEmpty($deploymentId); $cookie = 'cookieName=cookieValue; cookie2=value2; cookie3=value=3; cookie4=val:ue4; cookie5=value5'; $execution = $this->createExecution($functionId, [ @@ -1623,6 +1671,13 @@ class FunctionsCustomServerTest extends Scope $this->assertEquals($cookie, $execution['body']['responseBody']); $this->assertGreaterThan(0, $execution['body']['duration']); + $deployment = $this->getDeployment($functionId, $deploymentId); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['sourceSize']); + $this->assertGreaterThan(0, $deployment['body']['buildSize']); + $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; + $this->assertEquals($totalSize, $deployment['body']['totalSize']); + $this->cleanupFunction($functionId); } @@ -1637,22 +1692,7 @@ class FunctionsCustomServerTest extends Scope 'execute' => ['any'] ]); - $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => [ - Query::equal('resourceId', [$functionId])->toString(), - Query::equal('resourceType', ['function'])->toString(), - ], - ]); - - $this->assertEquals(200, $rules['headers']['status-code']); - $this->assertEquals(1, $rules['body']['total']); - $this->assertCount(1, $rules['body']['rules']); - $this->assertNotEmpty($rules['body']['rules'][0]['domain']); - - $domain = $rules['body']['rules'][0]['domain']; + $domain = $this->setupFunctionDomain($functionId); $this->setupDeployment($functionId, [ 'entrypoint' => 'index.php', @@ -1686,12 +1726,12 @@ class FunctionsCustomServerTest extends Scope }); $this->assertEventually(function () use ($functionId) { - $response = $this->getFunctionUsage($functionId, [ + $response = $this->getUsage($functionId, [ 'range' => '24h' ]); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertEquals(19, count($response['body'])); + $this->assertEquals(24, count($response['body'])); $this->assertEquals('24h', $response['body']['range']); $this->assertEquals(1, $response['body']['executionsTotal']); }, 25000, 1000); @@ -1710,22 +1750,7 @@ class FunctionsCustomServerTest extends Scope 'execute' => ['any'] ]); - $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => [ - Query::equal('resourceId', [$functionId])->toString(), - Query::equal('resourceType', ['function'])->toString(), - ], - ]); - - $this->assertEquals(200, $rules['headers']['status-code']); - $this->assertEquals(1, $rules['body']['total']); - $this->assertCount(1, $rules['body']['rules']); - $this->assertNotEmpty($rules['body']['rules'][0]['domain']); - - $domain = $rules['body']['rules'][0]['domain']; + $domain = $this->setupFunctionDomain($functionId); $this->setupDeployment($functionId, [ 'entrypoint' => 'index.php', @@ -1760,22 +1785,7 @@ class FunctionsCustomServerTest extends Scope 'execute' => ['any'] ]); - $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => [ - Query::equal('resourceId', [$functionId])->toString(), - Query::equal('resourceType', ['function'])->toString(), - ], - ]); - - $this->assertEquals(200, $rules['headers']['status-code']); - $this->assertEquals(1, $rules['body']['total']); - $this->assertCount(1, $rules['body']['rules']); - $this->assertNotEmpty($rules['body']['rules'][0]['domain']); - - $domain = $rules['body']['rules'][0]['domain']; + $domain = $this->setupFunctionDomain($functionId); $this->setupDeployment($functionId, [ 'entrypoint' => 'index.php', @@ -1893,7 +1903,9 @@ class FunctionsCustomServerTest extends Scope $this->assertFalse($function['body']['logging']); $this->assertNotEmpty($function['body']['$id']); - $functionId = $functionId = $function['body']['$id'] ?? ''; + $functionId = $function['body']['$id'] ?? ''; + + $domain = $this->setupFunctionDomain($functionId); $this->setupDeployment($functionId, [ 'code' => $this->packageFunction('node'), @@ -1929,20 +1941,7 @@ class FunctionsCustomServerTest extends Scope }, 10000, 500); // Domain Executions test - $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'queries' => [ - Query::equal('resourceId', [$functionId])->toString(), - Query::equal('resourceType', ['function'])->toString(), - ], - ]); - - $this->assertEquals(200, $rules['headers']['status-code']); - $this->assertNotEmpty($rules['body']['rules'][0]['domain']); - - $domain = $rules['body']['rules'][0]['domain']; + $domain = $this->getFunctionDomain($functionId); $proxyClient = new Client(); $proxyClient->setEndpoint('http://' . $domain); @@ -2023,4 +2022,331 @@ class FunctionsCustomServerTest extends Scope $this->cleanupFunction($functionId); } + + public function testDuplicateDeployment(): void + { + $functionId = $this->setupFunction([ + 'functionId' => ID::unique(), + 'runtime' => 'node-18.0', + 'name' => 'Duplicate Deployment Test', + 'entrypoint' => 'index.js', + 'commands' => '' + ]); + $this->assertNotEmpty($functionId); + + $deploymentId1 = $this->setupDeployment($functionId, [ + 'code' => $this->packageFunction('node'), + 'activate' => true + ]); + $this->assertNotEmpty($deploymentId1); + + $execution = $this->createExecution($functionId); + $this->assertEquals(201, $execution['headers']['status-code']); + $this->assertStringContainsString('APPWRITE_FUNCTION_ID', $execution['body']['responseBody']); + + $function = $this->updateFunction($functionId, [ + 'runtime' => 'node-18.0', + 'name' => 'Duplicate Deployment Test', + 'entrypoint' => 'index.js', + 'commands' => 'rm index.js && mv maintenance.js index.js' + ]); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertStringContainsString('maintenance.js', $function['body']['commands']); + + $deployment = $this->createDuplicateDeployment($functionId, $deploymentId1); + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId2 = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId2); + + $deployment = $this->getDeployment($functionId, $deploymentId2); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['sourceSize']); + $this->assertEquals(0, $deployment['body']['buildSize']); + $this->assertEquals($deployment['body']['sourceSize'], $deployment['body']['totalSize']); + + $this->assertEventually(function () use ($functionId, $deploymentId2) { + $function = $this->getFunction($functionId); + $this->assertEquals($deploymentId2, $function['body']['deploymentId']); + }, 50000, 500); + + $execution = $this->createExecution($functionId); + $this->assertEquals(201, $execution['headers']['status-code']); + $this->assertStringContainsString('Maintenance', $execution['body']['responseBody']); + + $deployment = $this->getDeployment($functionId, $deploymentId2); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['sourceSize']); + $this->assertGreaterThan(0, $deployment['body']['buildSize']); + $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; + $this->assertEquals($totalSize, $deployment['body']['totalSize']); + + $this->cleanupFunction($functionId); + } + + public function testUpdateDeploymentStatus(): void + { + + $functionId = $this->setupFunction([ + 'functionId' => ID::unique(), + 'runtime' => 'php-8.0', + 'name' => 'Re-activate Test', + 'entrypoint' => 'index.php', + ]); + $this->assertNotEmpty($functionId); + + + $function = $this->getFunction($functionId); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertArrayHasKey('latestDeploymentId', $function['body']); + $this->assertArrayHasKey('latestDeploymentCreatedAt', $function['body']); + $this->assertArrayHasKey('latestDeploymentStatus', $function['body']); + $this->assertEmpty($function['body']['latestDeploymentId']); + $this->assertEmpty($function['body']['latestDeploymentCreatedAt']); + $this->assertEmpty($function['body']['latestDeploymentStatus']); + + $deploymentId1 = $this->setupDeployment($functionId, [ + 'code' => $this->packageFunction('php-cookie'), + 'activate' => true + ]); + $this->assertNotEmpty($deploymentId1); + + $function = $this->getFunction($functionId); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals($deploymentId1, $function['body']['latestDeploymentId']); + $this->assertEquals('ready', $function['body']['latestDeploymentStatus']); + + $execution = $this->createExecution($functionId, [ + 'headers' => [ 'cookie' => 'cookieName=cookieValue' ] + ]); + $this->assertEquals(201, $execution['headers']['status-code']); + $this->assertNotEmpty($execution['body']['$id']); + $this->assertStringContainsString('cookieValue', $execution['body']['responseBody']); + + $deploymentId2 = $this->setupDeployment($functionId, [ + 'code' => $this->packageFunction('php'), + 'activate' => true + ]); + $this->assertNotEmpty($deploymentId2); + + $function = $this->getFunction($functionId); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals($deploymentId2, $function['body']['latestDeploymentId']); + $this->assertEquals('ready', $function['body']['latestDeploymentStatus']); + + $execution = $this->createExecution($functionId); + $this->assertEquals(201, $execution['headers']['status-code']); + $this->assertNotEmpty($execution['body']['$id']); + $this->assertStringContainsString('UNICODE_TEST', $execution['body']['responseBody']); + + $function = $this->getFunction($functionId); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals($deploymentId2, $function['body']['deploymentId']); + $this->assertEquals($deploymentId2, $function['body']['latestDeploymentId']); + $this->assertEquals('ready', $function['body']['latestDeploymentStatus']); + + $function = $this->updateFunctionDeployment($functionId, $deploymentId1); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals($deploymentId1, $function['body']['deploymentId']); + + $function = $this->getFunction($functionId); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals($deploymentId1, $function['body']['deploymentId']); + $this->assertEquals($deploymentId2, $function['body']['latestDeploymentId']); + $this->assertEquals('ready', $function['body']['latestDeploymentStatus']); + + $execution = $this->createExecution($functionId, [ + 'headers' => [ 'cookie' => 'cookieName=cookieValue' ] + ]); + $this->assertEquals(201, $execution['headers']['status-code']); + $this->assertNotEmpty($execution['body']['$id']); + $this->assertStringContainsString('cookieValue', $execution['body']['responseBody']); + + $deployment = $this->deleteDeployment($functionId, $deploymentId2); + $this->assertEquals(204, $deployment['headers']['status-code']); + + $function = $this->getFunction($functionId); + $this->assertEquals(200, $function['headers']['status-code']); + $this->assertEquals($deploymentId1, $function['body']['latestDeploymentId']); + $this->assertEquals('ready', $function['body']['latestDeploymentStatus']); + + $this->cleanupFunction($functionId); + } + + #[Retry(count: 3)] + public function testErrorPages(): void + { + // non-existent domain + $domain = 'non-existent-page.functions.localhost'; + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + + $this->assertEquals(404, $response['headers']['status-code']); + $this->assertStringContainsString('Nothing is here yet', $response['body']); + $this->assertStringContainsString('Start with this domain', $response['body']); + + // failed deployment + $functionId = $this->setupFunction([ + 'functionId' => ID::unique(), + 'name' => 'Test Error Pages', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'timeout' => 15, + 'commands' => 'cd non-existing-directory', + 'execute' => ['any'] + ]); + + $domain = $this->setupFunctionDomain($functionId); + $proxyClient->setEndpoint('http://' . $domain); + + $deployment = $this->createDeployment($functionId, [ + 'entrypoint' => 'index.php', + 'code' => $this->packageFunction('php'), + 'activate' => true + ]); + + $this->assertEquals(202, $deployment['headers']['status-code']); + + $response = $proxyClient->call(Client::METHOD_GET, '/', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ])); + + $this->assertEquals(404, $response['headers']['status-code']); + $this->assertStringContainsString('No active deployments', $response['body']); + $this->assertStringContainsString('View deployments', $response['body']); + + // canceled deployment + $deployment = $this->createDeployment($functionId, [ + 'entrypoint' => 'index.php', + 'code' => $this->packageFunction('php'), + 'activate' => true + ]); + + $deploymentId = $deployment['body']['$id'] ?? ''; + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deployment = $this->cancelDeployment($functionId, $deploymentId); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertEquals('canceled', $deployment['body']['status']); + + $response = $proxyClient->call(Client::METHOD_GET, '/', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ])); + + $this->assertEquals(404, $response['headers']['status-code']); + $this->assertStringContainsString('No active deployments', $response['body']); + $this->assertStringContainsString('View deployments', $response['body']); + + $this->cleanupFunction($functionId); + } + + public function testErrorPagesPermissions(): void + { + $functionId = $this->setupFunction([ + 'functionId' => ID::unique(), + 'name' => 'Test Error Pages', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'timeout' => 15, + 'commands' => '', + 'execute' => ['users'] + ]); + + $domain = $this->setupFunctionDomain($functionId); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $deploymentId = $this->setupDeployment($functionId, [ + 'code' => $this->packageFunction('php'), + 'activate' => true + ]); + $this->assertNotEmpty($deploymentId); + + $response = $proxyClient->call(Client::METHOD_GET, '/', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ])); + + $this->assertEquals(401, $response['headers']['status-code']); + $this->assertStringContainsString('Execution not permitted', $response['body']); + $this->assertStringContainsString('View settings', $response['body']); + + $this->cleanupFunction($functionId); + } + + public function testErrorPagesEmptyBody(): void + { + $functionId = $this->setupFunction([ + 'functionId' => ID::unique(), + 'name' => 'Test Error Pages', + 'runtime' => 'php-8.0', + 'entrypoint' => 'index.php', + 'timeout' => 15, + 'commands' => '', + 'execute' => ['any'] + ]); + + $domain = $this->setupFunctionDomain($functionId); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $deploymentId = $this->setupDeployment($functionId, [ + 'code' => $this->packageFunction('php'), + 'activate' => true + ]); + $this->assertNotEmpty($deploymentId); + + $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=404', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ])); + $this->assertEquals(404, $response['headers']['status-code']); + $this->assertStringContainsString('Error 404', $response['body']); + $this->assertStringContainsString('does not exist', $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=504', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ])); + $this->assertEquals(504, $response['headers']['status-code']); + $this->assertStringContainsString('Error 504', $response['body']); + $this->assertStringContainsString('respond in time', $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=400', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ])); + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertStringContainsString('Error 400', $response['body']); + $this->assertStringContainsString('unexpected client error', $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=500', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ])); + $this->assertEquals(500, $response['headers']['status-code']); + $this->assertStringContainsString('Error 500', $response['body']); + $this->assertStringContainsString('unexpected server error', $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=400&body=CustomError400', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ])); + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertStringContainsString('CustomError400', $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/custom-response?code=500&body=CustomError500', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ])); + $this->assertEquals(500, $response['headers']['status-code']); + $this->assertStringContainsString('CustomError500', $response['body']); + + $this->cleanupFunction($functionId); + } } diff --git a/tests/e2e/Services/GraphQL/AbuseTest.php b/tests/e2e/Services/GraphQL/AbuseTest.php index d4e87cf029..ea97492c2b 100644 --- a/tests/e2e/Services/GraphQL/AbuseTest.php +++ b/tests/e2e/Services/GraphQL/AbuseTest.php @@ -88,7 +88,7 @@ class AbuseTest extends Scope $response = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, - ], $this->getHeaders()), $graphQLPayload); + ], $this->getHeaders(false)), $graphQLPayload); $max = System::getEnv('_APP_GRAPHQL_MAX_QUERY_COMPLEXITY', 250); diff --git a/tests/e2e/Services/GraphQL/AvatarsTest.php b/tests/e2e/Services/GraphQL/AvatarsTest.php index 9f3fa7a3bb..e3aaa2ce80 100644 --- a/tests/e2e/Services/GraphQL/AvatarsTest.php +++ b/tests/e2e/Services/GraphQL/AvatarsTest.php @@ -134,7 +134,7 @@ class AvatarsTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $graphQLPayload); - $this->assertEquals(29428, \strlen($qrCode['body'])); + $this->assertEquals(9169, \strlen($qrCode['body'])); return $qrCode['body']; } diff --git a/tests/e2e/Services/GraphQL/Base.php b/tests/e2e/Services/GraphQL/Base.php index 0b3250cecf..121d40156e 100644 --- a/tests/e2e/Services/GraphQL/Base.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -1568,7 +1568,7 @@ trait Base _id buildId entrypoint - size + buildSize status buildLogs } @@ -1620,7 +1620,7 @@ trait Base }'; case self::$RETRY_BUILD: return 'mutation retryBuild($functionId: String!, $deploymentId: String!, $buildId: String!) { - functionsCreateBuild(functionId: $functionId, deploymentId: $deploymentId, buildId: $buildId) { + functionsCreateDuplicateDeployment(functionId: $functionId, deploymentId: $deploymentId, buildId: $buildId) { status } }'; diff --git a/tests/e2e/Services/GraphQL/FunctionsClientTest.php b/tests/e2e/Services/GraphQL/FunctionsClientTest.php index 0b43ed5772..14b714d551 100644 --- a/tests/e2e/Services/GraphQL/FunctionsClientTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsClientTest.php @@ -133,7 +133,7 @@ class FunctionsClientTest extends Scope $deployment = $deployment['body']['data']['functionsGetDeployment']; $this->assertEquals('ready', $deployment['status']); - }); + }, 60000); return $deployment; } diff --git a/tests/e2e/Services/GraphQL/FunctionsServerTest.php b/tests/e2e/Services/GraphQL/FunctionsServerTest.php index e49ac43619..d211dcceea 100644 --- a/tests/e2e/Services/GraphQL/FunctionsServerTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsServerTest.php @@ -130,7 +130,7 @@ class FunctionsServerTest extends Scope $deployment = $deployment['body']['data']['functionsGetDeployment']; $this->assertEquals('ready', $deployment['status']); - }); + }, 30000); return $deployment; } @@ -186,8 +186,8 @@ class FunctionsServerTest extends Scope 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $gqlPayload); - $this->assertIsNotArray($response['body']); - $this->assertEquals(204, $response['headers']['status-code']); + $this->assertIsArray($response['body']['data']); + $this->assertEquals(200, $response['headers']['status-code']); } public function testGetFunctions(): array @@ -252,7 +252,7 @@ class FunctionsServerTest extends Scope $runtimes = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, - ], $this->getHeaders()), $gqlPayload); + ]), $gqlPayload); $this->assertIsArray($runtimes['body']['data']); $this->assertArrayNotHasKey('errors', $runtimes['body']); diff --git a/tests/e2e/Services/Migrations/MigrationsBase.php b/tests/e2e/Services/Migrations/MigrationsBase.php index 6c468ee730..c241b38e3d 100644 --- a/tests/e2e/Services/Migrations/MigrationsBase.php +++ b/tests/e2e/Services/Migrations/MigrationsBase.php @@ -10,8 +10,10 @@ use Tests\E2E\Services\Functions\FunctionsBase; use Utopia\Database\Helpers\ID; use Utopia\Database\Helpers\Permission; use Utopia\Database\Helpers\Role; +use Utopia\Database\Query; use Utopia\Migration\Resource; use Utopia\Migration\Sources\Appwrite; +use Utopia\Migration\Sources\CSV; trait MigrationsBase { @@ -896,4 +898,295 @@ trait MigrationsBase 'x-appwrite-key' => $this->getDestinationProject()['apiKey'], ]); } + + /** + * Import documents from a CSV file. + */ + public function testCreateCsvMigration(): array + { + // make a database + $response = $this->client->call(Client::METHOD_POST, '/databases', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ], [ + 'databaseId' => ID::unique(), + 'name' => 'Test Database' + ]); + + $this->assertNotEmpty($response['body']['$id']); + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertEquals('Test Database', $response['body']['name']); + + $databaseId = $response['body']['$id']; + + // make a collection + $response = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'name' => 'Test collection', + 'collectionId' => ID::unique(), + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertEquals($response['body']['name'], 'Test collection'); + + $collectionId = $response['body']['$id']; + + // make attributes + $response = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'name', + 'size' => 256, + 'required' => true, + ]); + + $this->assertEquals(202, $response['headers']['status-code']); + $this->assertEquals($response['body']['key'], 'name'); + $this->assertEquals($response['body']['type'], 'string'); + $this->assertEquals($response['body']['size'], 256); + $this->assertEquals($response['body']['required'], true); + + $response = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $collectionId . '/attributes/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'age', + 'min' => 18, + 'max' => 65, + 'required' => true, + ]); + + $this->assertEquals(202, $response['headers']['status-code']); + $this->assertEquals($response['body']['key'], 'age'); + $this->assertEquals($response['body']['type'], 'integer'); + $this->assertEquals($response['body']['min'], 18); + $this->assertEquals($response['body']['max'], 65); + $this->assertEquals($response['body']['required'], true); + + // make a bucket, upload a file to it! + $bucketOne = $this->client->call(Client::METHOD_POST, '/storage/buckets', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'bucketId' => ID::unique(), + 'name' => 'Test Bucket', + 'maximumFileSize' => 2000000, //2MB + 'allowedFileExtensions' => ['csv'], + 'compression' => 'gzip', + 'encryption' => true + ]); + $this->assertEquals(201, $bucketOne['headers']['status-code']); + $this->assertNotEmpty($bucketOne['body']['$id']); + + $bucketOneId = $bucketOne['body']['$id']; + + $bucketIds = [ + 'default' => $bucketOneId, + 'missing-row' => $bucketOneId, + 'missing-column' => $bucketOneId, + 'irrelevant-column' => $bucketOneId, + ]; + + $fileIds = []; + + foreach ($bucketIds as $label => $bucketId) { + $csvFileName = match ($label) { + 'missing-row', + 'missing-column', + 'irrelevant-column' => "{$label}.csv", + default => 'documents.csv', + }; + + $mimeType = match ($csvFileName) { + default => 'text/csv', + 'missing-row.csv' => 'text/plain', // invalid csv structure, falls back to plain text! + }; + + $response = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/csv/'.$csvFileName), $mimeType, $csvFileName), + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + $this->assertEquals($csvFileName, $response['body']['name']); + $this->assertEquals($mimeType, $response['body']['mimeType']); + + $fileIds[$label] = $response['body']['$id']; + } + + // missing attribute, fail in worker. + $missingColumn = $this->performCsvMigration( + [ + 'fileId' => $fileIds['missing-column'], + 'bucketId' => $bucketIds['missing-column'], + 'resourceId' => $databaseId . ':' . $collectionId, + ] + ); + + $this->assertEventually(function () use ($missingColumn, $databaseId, $collectionId) { + $migrationId = $missingColumn['body']['$id']; + $migration = $this->client->call(Client::METHOD_GET, '/migrations/'.$migrationId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $migration['headers']['status-code']); + $this->assertEquals('finished', $migration['body']['stage']); + $this->assertEquals('failed', $migration['body']['status']); + $this->assertEquals('CSV', $migration['body']['source']); + $this->assertEquals('Appwrite', $migration['body']['destination']); + $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); + $this->assertEmpty($migration['body']['statusCounters']); + $this->assertThat( + implode("\n", $migration['body']['errors']), + $this->stringContains("CSV header mismatch. Missing attribute: 'age'") + ); + }, 60000, 500); + + // missing row data, fail in worker. + $missingColumn = $this->performCsvMigration( + [ + 'fileId' => $fileIds['missing-row'], + 'bucketId' => $bucketIds['missing-row'], + 'resourceId' => $databaseId . ':' . $collectionId, + ] + ); + + $this->assertEventually(function () use ($missingColumn, $databaseId, $collectionId) { + $migrationId = $missingColumn['body']['$id']; + $migration = $this->client->call(Client::METHOD_GET, '/migrations/'.$migrationId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $migration['headers']['status-code']); + $this->assertEquals('finished', $migration['body']['stage']); + $this->assertEquals('failed', $migration['body']['status']); + $this->assertEquals('CSV', $migration['body']['source']); + $this->assertEquals('Appwrite', $migration['body']['destination']); + $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); + $this->assertEmpty($migration['body']['statusCounters']); + $this->assertThat( + implode("\n", $migration['body']['errors']), + $this->stringContains('CSV row does not match the number of header columns') + ); + }, 60000, 500); + + // irrelevant column - email, fail in worker. + $irrelevantColumn = $this->performCsvMigration( + [ + 'fileId' => $fileIds['irrelevant-column'], + 'bucketId' => $bucketIds['irrelevant-column'], + 'resourceId' => $databaseId . ':' . $collectionId, + ] + ); + + $this->assertEventually(function () use ($irrelevantColumn, $databaseId, $collectionId) { + $migrationId = $irrelevantColumn['body']['$id']; + $migration = $this->client->call(Client::METHOD_GET, '/migrations/'.$migrationId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $migration['headers']['status-code']); + $this->assertEquals('finished', $migration['body']['stage']); + $this->assertEquals('failed', $migration['body']['status']); + $this->assertEquals('CSV', $migration['body']['source']); + $this->assertEquals('Appwrite', $migration['body']['destination']); + $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); + $this->assertEmpty($migration['body']['statusCounters']); + $this->assertThat( + implode("\n", $migration['body']['errors']), + $this->stringContains("CSV header mismatch. Unexpected attribute: 'email'") + ); + }, 60000, 500); + + // all data exists, pass/ + $migration = $this->performCsvMigration( + [ + 'endpoint' => 'http://localhost/v1', + 'fileId' => $fileIds['default'], + 'bucketId' => $bucketIds['default'], + 'resourceId' => $databaseId . ':' . $collectionId, + ] + ); + + $this->assertEmpty($migration['body']['statusCounters']); + $this->assertEquals('CSV', $migration['body']['source']); + $this->assertEquals('pending', $migration['body']['status']); + $this->assertEquals('Appwrite', $migration['body']['destination']); + $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); + + return [ + 'databaseId' => $databaseId, + 'collectionId' => $collectionId, + 'migrationId' => $migration['body']['$id'], + ]; + } + + /** + * @depends testCreateCsvMigration + */ + public function testImportSuccessful(array $response): void + { + $databaseId = $response['databaseId']; + $collectionId = $response['collectionId']; + $migrationId = $response['migrationId']; + + $documentsCountInCSV = 100; + + // get migration stats + $this->assertEventually(function () use ($migrationId, $databaseId, $collectionId, $documentsCountInCSV) { + $migration = $this->client->call(Client::METHOD_GET, '/migrations/'.$migrationId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $migration['headers']['status-code']); + $this->assertEquals('finished', $migration['body']['stage']); + $this->assertEquals('completed', $migration['body']['status']); + $this->assertEquals('CSV', $migration['body']['source']); + $this->assertEquals('Appwrite', $migration['body']['destination']); + $this->assertContains(Resource::TYPE_DOCUMENT, $migration['body']['resources']); + $this->assertArrayHasKey(Resource::TYPE_DOCUMENT, $migration['body']['statusCounters']); + $this->assertEquals($documentsCountInCSV, $migration['body']['statusCounters'][Resource::TYPE_DOCUMENT]['success']); + }, 60000, 500); + + // get documents count + $documents = $this->client->call(Client::METHOD_GET, '/databases/'.$databaseId.'/collections/'.$collectionId.'/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + // there should be only 100! + Query::limit(150)->toString() + ] + ]); + + $this->assertEquals(200, $documents['headers']['status-code']); + $this->assertIsArray($documents['body']['documents']); + $this->assertIsNumeric($documents['body']['total']); + $this->assertEquals($documentsCountInCSV, $documents['body']['total']); + } + + private function performCsvMigration(array $body): array + { + return $this->client->call(Client::METHOD_POST, '/migrations/csv', [ + 'content-type' => 'application/json', + 'x-appwrite-key' => $this->getProject()['apiKey'], + 'x-appwrite-project' => $this->getProject()['$id'], + ], $body); + } } diff --git a/tests/e2e/Services/Projects/ProjectsBase.php b/tests/e2e/Services/Projects/ProjectsBase.php index 53d9626252..0d1d6a5a44 100644 --- a/tests/e2e/Services/Projects/ProjectsBase.php +++ b/tests/e2e/Services/Projects/ProjectsBase.php @@ -2,6 +2,48 @@ namespace Tests\E2E\Services\Projects; +use Tests\E2E\Client; +use Utopia\Database\Helpers\ID; + trait ProjectsBase { + protected function setupProject(mixed $params): string + { + $team = $this->client->call(Client::METHOD_POST, '/teams', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'teamId' => ID::unique(), + 'name' => 'Project Test', + ]); + + $this->assertEquals(201, $team['headers']['status-code'], 'Setup team failed with status code: ' . $team['headers']['status-code'] . ' and response: ' . json_encode($team['body'], JSON_PRETTY_PRINT)); + + $project = $this->client->call(Client::METHOD_POST, '/projects', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + ...$params, + 'teamId' => $team['body']['$id'], + ]); + + $this->assertEquals(201, $project['headers']['status-code'], 'Setup project failed with status code: ' . $project['headers']['status-code'] . ' and response: ' . json_encode($project['body'], JSON_PRETTY_PRINT)); + + return $project['body']['$id']; + } + + protected function setupDevKey(mixed $params): array + { + $devKey = $this->client->call(Client::METHOD_POST, '/projects/' . $params['projectId'] . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + $this->assertEquals(201, $devKey['headers']['status-code'], 'Setup devKey failed with status code: ' . $devKey['headers']['status-code'] . ' and response: ' . json_encode($devKey['body'], JSON_PRETTY_PRINT)); + + return [ + '$id' => $devKey['body']['$id'], + 'secret' => $devKey['body']['secret'], + ]; + } } diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index f89428d79a..aea1971be7 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -24,6 +24,7 @@ class ProjectsConsoleClientTest extends Scope use Async; /** + * @group devKeys * @group smtpAndTemplates * @group projectsCRUD */ public function testCreateProject(): array @@ -4002,12 +4003,33 @@ class ProjectsConsoleClientTest extends Scope 'x-appwrite-mode' => 'admin', ], $this->getHeaders()), [ 'key' => 'APP_TEST', - 'value' => 'TESTINGVALUE' + 'value' => 'TESTINGVALUE', + 'secret' => false ]); $this->assertEquals(201, $variable['headers']['status-code']); + $this->assertEquals('APP_TEST', $variable['body']['key']); + $this->assertEquals('TESTINGVALUE', $variable['body']['value']); + $this->assertFalse($variable['body']['secret']); $variableId = $variable['body']['$id']; + // test for secret variable + $variable = $this->client->call(Client::METHOD_POST, '/project/variables', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $data['projectId'], + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders()), [ + 'key' => 'APP_TEST_1', + 'value' => 'TESTINGVALUE_1', + 'secret' => true + ]); + + $this->assertEquals(201, $variable['headers']['status-code']); + $this->assertEquals('APP_TEST_1', $variable['body']['key']); + $this->assertEmpty($variable['body']['value']); + + $secretVariableId = $variable['body']['$id']; + /** * Test for FAILURE */ @@ -4051,6 +4073,7 @@ class ProjectsConsoleClientTest extends Scope $data, [ 'variableId' => $variableId, + 'secretVariableId' => $secretVariableId ] ); } @@ -4071,10 +4094,12 @@ class ProjectsConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertCount(1, $response['body']['variables']); - $this->assertEquals(1, $response['body']['total']); + $this->assertCount(2, $response['body']['variables']); + $this->assertEquals(2, $response['body']['total']); $this->assertEquals("APP_TEST", $response['body']['variables'][0]['key']); $this->assertEquals("TESTINGVALUE", $response['body']['variables'][0]['value']); + $this->assertEquals("APP_TEST_1", $response['body']['variables'][1]['key']); + $this->assertEmpty($response['body']['variables'][1]['value']); return $data; } @@ -4097,6 +4122,17 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals("APP_TEST", $response['body']['key']); $this->assertEquals("TESTINGVALUE", $response['body']['value']); + $response = $this->client->call(Client::METHOD_GET, '/project/variables/' . $data['secretVariableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $data['projectId'], + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders())); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals("APP_TEST_1", $response['body']['key']); + $this->assertEmpty($response['body']['value']); + $this->assertTrue($response['body']['secret']); + /** * Test for FAILURE */ @@ -4144,6 +4180,40 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals("APP_TEST_UPDATE", $variable['body']['key']); $this->assertEquals("TESTINGVALUEUPDATED", $variable['body']['value']); + $response = $this->client->call(Client::METHOD_PUT, '/project/variables/' . $data['secretVariableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $data['projectId'], + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders()), [ + 'key' => 'APP_TEST_UPDATE_1', + 'value' => 'TESTINGVALUEUPDATED_1' + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals("APP_TEST_UPDATE_1", $response['body']['key']); + $this->assertEmpty($response['body']['value']); + + $variable = $this->client->call(Client::METHOD_GET, '/project/variables/' . $data['secretVariableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $data['projectId'], + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders())); + + $this->assertEquals(200, $variable['headers']['status-code']); + $this->assertEquals("APP_TEST_UPDATE_1", $variable['body']['key']); + $this->assertEmpty($variable['body']['value']); + + $response = $this->client->call(Client::METHOD_PUT, '/project/variables/' . $data['secretVariableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $data['projectId'], + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders()), [ + 'key' => 'APP_TEST_UPDATE_1', + 'secret' => false, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + $response = $this->client->call(Client::METHOD_GET, '/project/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $data['projectId'], @@ -4151,8 +4221,9 @@ class ProjectsConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $response['headers']['status-code']); - $this->assertCount(1, $response['body']['variables']); + $this->assertCount(2, $response['body']['variables']); $this->assertEquals("APP_TEST_UPDATE", $response['body']['variables'][0]['key']); + $this->assertEquals("APP_TEST_UPDATE_1", $response['body']['variables'][1]['key']); /** * Test for FAILURE @@ -4231,6 +4302,14 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(204, $response['headers']['status-code']); + $this->assertEquals(204, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_DELETE, '/project/variables/' . $data['secretVariableId'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $data['projectId'], + 'x-appwrite-mode' => 'admin', + ], $this->getHeaders())); + $response = $this->client->call(Client::METHOD_GET, '/project/variables', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $data['projectId'], @@ -4255,4 +4334,610 @@ class ProjectsConsoleClientTest extends Scope return $data; } + + /** + * Devkeys Tests starts here ------------------------------------------------ + */ + + /** + * @group devKeys + */ + public function testCreateProjectDevKey(): void + { + /** + * Test for SUCCESS + */ + $id = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testCreateProjectDevKey', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + $this->assertEquals('Key Test', $response['body']['name']); + $this->assertNotEmpty($response['body']['secret']); + $this->assertArrayHasKey('accessedAt', $response['body']); + $this->assertEmpty($response['body']['accessedAt']); + + /** Create a second dev key */ + $response = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Dev Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + $this->assertEquals(201, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + $this->assertEquals('Dev Key Test', $response['body']['name']); + $this->assertNotEmpty($response['body']['secret']); + $this->assertArrayHasKey('accessedAt', $response['body']); + $this->assertEmpty($response['body']['accessedAt']); + + /** + * Test for FAILURE + */ + + /** TEST expiry date is required */ + $res = $this->client->call(Client::METHOD_POST, '/projects/' . $id . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Key Test' + ]); + + $this->assertEquals(400, $res['headers']['status-code']); + } + + + /** + * @group devKeys + */ + public function testListProjectDevKey(): void + { + /** + * Test for SUCCESS + */ + $projectId = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testListProjectDevKey', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + /** Create devKey 1 */ + $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + /** Create devKey 2 */ + $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Dev Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + /** List all dev keys */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(2, $response['body']['total']); + + /** List dev keys with limit */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::limit(1)->toString() + ] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(1, $response['body']['total']); + + /** List dev keys with search */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(2, $response['body']['total']); + $this->assertEquals('Key Test', $response['body']['devKeys'][0]['name']); + $this->assertEquals('Dev Key Test', $response['body']['devKeys'][1]['name']); + + /** List dev keys with querying `expire` */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [Query::lessThan('expire', (new \DateTime())->format('Y-m-d H:i:s'))->toString()] + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(0, $response['body']['total']); // No dev keys expired + + /** + * Test for FAILURE + */ + + /** Test for search with invalid query */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::search('name', 'Invalid')->toString() + ] + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertEquals('Invalid `queries` param: Invalid query: Attribute not found in schema: name', $response['body']['message']); + } + + + /** + * @group devKeys + */ + public function testGetProjectDevKey(): void + { + /** + * Test for SUCCESS + */ + $projectId = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testGetProjectDevKey', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $devKey = $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Dev Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys/' . $devKey['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + $this->assertEquals($devKey['$id'], $response['body']['$id']); + $this->assertEquals('Dev Key Test', $response['body']['name']); + $this->assertNotEmpty($response['body']['secret']); + $this->assertArrayHasKey('accessedAt', $response['body']); + $this->assertEmpty($response['body']['accessedAt']); + + /** + * Test for FAILURE + */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys/error', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(404, $response['headers']['status-code']); + } + + /** + * @group devKeys + */ + public function testGetDevKeyWithSdks(): void + { + /** + * Test for SUCCESS + */ + $projectId = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testGetDevKeyWithSdks', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $devKey = $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Dev Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + /** Use dev key with python sdk */ + $res = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $devKey['secret'], + 'x-sdk-name' => 'python' + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + $this->assertEquals(401, $res['headers']['status-code']); + + /** Use dev key with php sdk */ + $res = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $devKey['secret'], + 'x-sdk-name' => 'php' + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + $this->assertEquals(401, $res['headers']['status-code']); + + /** Get the dev key */ + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys/' . $devKey['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertArrayHasKey('sdks', $response['body']); + $this->assertCount(2, $response['body']['sdks']); + $this->assertContains('python', $response['body']['sdks']); + $this->assertContains('php', $response['body']['sdks']); + } + + /** + * @group devKeys + */ + public function testNoHostValidationWithDevKey(): void + { + /** + * Test for SUCCESS + */ + $projectId = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testNoHostValidationWithDevKey', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $devKey = $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Dev Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + $provider = 'mock'; + $appId = '1'; + $secret = '123456'; + + $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $projectId . '/oauth2', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'provider' => $provider, + 'appId' => $appId, + 'secret' => $secret, + 'enabled' => true, + ]); + $this->assertEquals(200, $response['headers']['status-code']); + + /** Test oauth2 and get invalid `success` URL */ + $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'success' => 'https://example.com', + 'failure' => 'https://example.com' + ]); + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertStringContainsString('Invalid `success` param: URL host must be one of: localhost, appwrite.io, *.appwrite.io', $response['body']); + + /** Test oauth2 with devKey and now get oauth2 is disabled */ + $response = $this->client->call(Client::METHOD_GET, '/account/sessions/oauth2/' . $provider, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $devKey['secret'] + ], [ + 'success' => 'https://example.com', + 'failure' => 'https://example.com' + ]); + $this->assertEquals(200, $response['headers']['status-code']); + + /** Test hostname in Magic URL */ + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/magic-url', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'userId' => ID::unique(), + 'email' => 'user@appwrite.io', + 'url' => 'https://example.com', + ]); + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertEquals('Invalid `url` param: URL host must be one of: localhost, appwrite.io, *.appwrite.io', $response['body']['message']); + + /** Test hostname in Magic URL with devKey */ + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/magic-url', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $devKey['secret'] + ], [ + 'userId' => ID::unique(), + 'email' => 'user@appwrite.io', + 'url' => 'https://example.com', + ]); + $this->assertEquals(201, $response['headers']['status-code']); + } + + /** + * @group devKeys + */ + public function testCorsWithDevKey(): void + { + /** + * Test for SUCCESS + */ + $projectId = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testCorsWithDevKey', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $devKey = $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Dev Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + $origin = 'http://example.com'; + + /** + * Test CORS without Dev Key (should fail due to origin) + */ + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'origin' => $origin, + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + + $this->assertEquals(403, $response['headers']['status-code']); + $this->assertNotEquals($origin, $response['headers']['access-control-allow-origin'] ?? null); + $this->assertEquals('http://localhost', $response['headers']['access-control-allow-origin'] ?? null); + + + /** + * Test CORS with Dev Key (should bypass origin check) + */ + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'origin' => $origin, + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $devKey['secret'] + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + + $this->assertEquals(401, $response['headers']['status-code']); + $this->assertEquals('*', $response['headers']['access-control-allow-origin'] ?? null); + } + + /** + * @group devKeys + */ + public function testNoRateLimitWithDevKey(): void + { + /** + * Test for SUCCESS + */ + $projectId = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testNoRateLimitWithDevKey', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $devKey = $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Dev Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + /** + * Test for SUCCESS + */ + for ($i = 0; $i < 10; $i++) { + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + $this->assertEquals(401, $response['headers']['status-code']); + } + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + $this->assertEquals(429, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $devKey['secret'] + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + $this->assertEquals(401, $response['headers']['status-code']); + + /** + * Test for FAILURE + */ + $response = $this->client->call(Client::METHOD_POST, '/projects/' . $projectId . '/dev-keys', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), -3600), + ]); + + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $response['body']['secret'] + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + $this->assertEquals(429, $response['headers']['status-code']); + + /** + * Test for FAILURE after expire + */ + $devKey = $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Dev Key Test Expire 5 seconds', + 'expire' => DateTime::addSeconds(new \DateTime(), 5) + ]); + + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $devKey['secret'] + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + $this->assertEquals(401, $response['headers']['status-code']); + + sleep(5); + + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $devKey['secret'] + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + $this->assertEquals(429, $response['headers']['status-code']); + } + + /** + * @group devKeys + */ + public function testUpdateProjectDevKey(): void + { + $projectId = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testUpdateProjectDevKey', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $devKey = $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Dev Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + $response = $this->client->call(Client::METHOD_PUT, '/projects/' . $projectId . '/dev-keys/' . $devKey['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'name' => 'Key Test Update', + 'expire' => DateTime::addSeconds(new \DateTime(), 360), + ]); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + $this->assertEquals($devKey['$id'], $response['body']['$id']); + $this->assertEquals('Key Test Update', $response['body']['name']); + $this->assertArrayHasKey('accessedAt', $response['body']); + $this->assertEmpty($response['body']['accessedAt']); + + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys/' . $devKey['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + $this->assertEquals($devKey['$id'], $response['body']['$id']); + $this->assertEquals('Key Test Update', $response['body']['name']); + $this->assertArrayHasKey('accessedAt', $response['body']); + $this->assertEmpty($response['body']['accessedAt']); + } + + /** + * @group devKeys + */ + public function testDeleteProjectDevKey(): void + { + $projectId = $this->setupProject([ + 'projectId' => ID::unique(), + 'name' => 'testDeleteProjectDevKey', + 'region' => System::getEnv('_APP_REGION', 'default') + ]); + + $devKey = $this->setupDevKey([ + 'projectId' => $projectId, + 'name' => 'Dev Key Test', + 'expire' => DateTime::addSeconds(new \DateTime(), 36000) + ]); + + $response = $this->client->call(Client::METHOD_DELETE, '/projects/' . $projectId . '/dev-keys/' . $devKey['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(204, $response['headers']['status-code']); + $this->assertEmpty($response['body']); + + /** + * Get rate limit trying to use the deleted key + */ + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + 'x-appwrite-dev-key' => $devKey['secret'] + ], [ + 'email' => 'user@appwrite.io', + 'password' => 'password' + ]); + $this->assertEquals(429, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_GET, '/projects/' . $projectId . '/dev-keys/' . $devKey['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(404, $response['headers']['status-code']); + + /** + * Test for FAILURE + */ + $response = $this->client->call(Client::METHOD_DELETE, '/projects/' . $projectId . '/dev-keys/error', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(404, $response['headers']['status-code']); + } + + /** + * Devkeys Tests ends here ------------------------------------------------ + */ } diff --git a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php index cc976b78f6..a01073f3a3 100644 --- a/tests/e2e/Services/Projects/ProjectsCustomServerTest.php +++ b/tests/e2e/Services/Projects/ProjectsCustomServerTest.php @@ -17,6 +17,8 @@ class ProjectsCustomServerTest extends Scope public function testCreateProjectRule() { + $testId = \uniqid(); + $headers = array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -24,25 +26,81 @@ class ProjectsCustomServerTest extends Scope 'cookie' => 'a_session_console=' . $this->getRoot()['session'], ]); - $response = $this->client->call(Client::METHOD_POST, '/proxy/rules', $headers, [ + $response = $this->client->call(Client::METHOD_POST, '/proxy/rules/api', $headers, [ + 'domain' => $testId . '-api.appwrite.test', + ]); + + \var_dump($response); + + $this->assertEquals(201, $response['headers']['status-code']); + + $response = $this->client->call(Client::METHOD_POST, '/proxy/rules/api', $headers, [ 'resourceType' => 'api', - 'domain' => 'api.appwrite.test', + 'domain' => $testId . '-abc.test.io', ]); $this->assertEquals(201, $response['headers']['status-code']); + // duplicate rule + $response2 = $this->client->call(Client::METHOD_POST, '/proxy/rules/api', $headers, [ + 'domain' => $testId . '-abc.test.io', + ]); + + $this->assertEquals(409, $response2['headers']['status-code']); + $response = $this->client->call(Client::METHOD_DELETE, '/proxy/rules/' . $response['body']['$id'], $headers); $this->assertEquals(204, $response['headers']['status-code']); - // prevent functions domain $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); - $response = $this->client->call(Client::METHOD_POST, '/proxy/rules', $headers, [ - 'resourceType' => 'api', + $response = $this->client->call(Client::METHOD_POST, '/proxy/rules/api', $headers, [ 'domain' => $functionsDomain, ]); $this->assertEquals(400, $response['headers']['status-code']); + + + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + + $response = $this->client->call(Client::METHOD_POST, '/proxy/rules/api', $headers, [ + 'domain' => $sitesDomain, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + // prevent functions domain + $response = $this->client->call(Client::METHOD_POST, '/proxy/rules/function', $headers, [ + 'domain' => $functionsDomain, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + // prevent sites domain + $response = $this->client->call(Client::METHOD_POST, '/proxy/rules/site', $headers, [ + 'domain' => $sitesDomain, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + $mainDomain = System::getEnv('_APP_DOMAIN', ''); + $sitesDomain = System::getEnv('_APP_DOMAIN_SITES', ''); + $functionsDomain = System::getEnv('_APP_DOMAIN_FUNCTIONS', ''); + + $deniedDomains = [ + $mainDomain, + $sitesDomain, + $functionsDomain, + 'localhost', + APP_HOSTNAME_INTERNAL, + ]; + + foreach ($deniedDomains as $deniedDomain) { + $response = $this->client->call(Client::METHOD_POST, '/proxy/rules/api', $headers, [ + 'domain' => $deniedDomain, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + } } } diff --git a/tests/e2e/Services/Proxy/ProxyBase.php b/tests/e2e/Services/Proxy/ProxyBase.php new file mode 100644 index 0000000000..44e015b751 --- /dev/null +++ b/tests/e2e/Services/Proxy/ProxyBase.php @@ -0,0 +1,297 @@ +<?php + +namespace Tests\E2E\Services\Proxy; + +use Appwrite\ID; +use Appwrite\Tests\Async; +use CURLFile; +use Tests\E2E\Client; +use Utopia\CLI\Console; + +trait ProxyBase +{ + use Async; + + protected function listRules(array $params = []): mixed + { + $rule = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $rule; + } + + protected function createAPIRule(string $domain): mixed + { + $rule = $this->client->call(Client::METHOD_POST, '/proxy/rules/api', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'domain' => $domain, + ]); + + return $rule; + } + + protected function updateRuleVerification(string $ruleId): mixed + { + $rule = $this->client->call(Client::METHOD_PATCH, '/proxy/rules/' . $ruleId . '/verification', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + return $rule; + } + + protected function createSiteRule(string $domain, string $siteId, string $branch = ''): mixed + { + $rule = $this->client->call(Client::METHOD_POST, '/proxy/rules/site', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'domain' => $domain, + 'siteId' => $siteId, + 'branch' => $branch, + ]); + + return $rule; + } + + protected function getRule(string $ruleId): mixed + { + $rule = $this->client->call(Client::METHOD_GET, '/proxy/rules/' . $ruleId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + return $rule; + } + + protected function createRedirectRule(string $domain, string $url, int $statusCode): mixed + { + $rule = $this->client->call(Client::METHOD_POST, '/proxy/rules/redirect', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'domain' => $domain, + 'url' => $url, + 'statusCode' => $statusCode, + ]); + + return $rule; + } + + protected function createFunctionRule(string $domain, string $functionId, string $branch = ''): mixed + { + $rule = $this->client->call(Client::METHOD_POST, '/proxy/rules/function', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'domain' => $domain, + 'functionId' => $functionId, + 'branch' => $branch, + ]); + + return $rule; + } + + protected function deleteRule(string $ruleId): mixed + { + $rule = $this->client->call(Client::METHOD_DELETE, '/proxy/rules/' . $ruleId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + return $rule; + } + + protected function setupAPIRule(string $domain): string + { + $rule = $this->createAPIRule($domain); + + $this->assertEquals(201, $rule['headers']['status-code'], 'Failed to setup rule: ' . \json_encode($rule)); + + return $rule['body']['$id']; + } + + protected function setupRedirectRule(string $domain, string $url, int $statusCode): string + { + $rule = $this->createRedirectRule($domain, $url, $statusCode); + + $this->assertEquals(201, $rule['headers']['status-code'], 'Failed to setup rule: ' . \json_encode($rule)); + + return $rule['body']['$id']; + } + + protected function setupFunctionRule(string $domain, string $functionId, string $branch = ''): string + { + $rule = $this->createFunctionRule($domain, $functionId, $branch); + + $this->assertEquals(201, $rule['headers']['status-code'], 'Failed to setup rule: ' . \json_encode($rule)); + + return $rule['body']['$id']; + } + + protected function setupSiteRule(string $domain, string $siteId, string $branch = ''): string + { + $rule = $this->createSiteRule($domain, $siteId, $branch); + + $this->assertEquals(201, $rule['headers']['status-code'], 'Failed to setup rule: ' . \json_encode($rule)); + + return $rule['body']['$id']; + } + + protected function cleanupRule(string $ruleId): void + { + $rule = $this->deleteRule($ruleId); + $this->assertEquals(204, $rule['headers']['status-code'], 'Failed to cleanup rule: ' . \json_encode($rule)); + } + + protected function cleanupSite(string $siteId): void + { + $site = $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(204, $site['headers']['status-code'], 'Failed to cleanup site: ' . \json_encode($site)); + } + + protected function cleanupFunction(string $functionId): void + { + $function = $this->client->call(Client::METHOD_DELETE, '/functions/' . $functionId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + $this->assertEquals(204, $function['headers']['status-code'], 'Failed to cleanup function: ' . \json_encode($function)); + } + + protected function setupSite(): mixed + { + // Site + $site = $this->client->call(Client::METHOD_POST, '/sites', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]), [ + 'siteId' => ID::unique(), + 'name' => 'Proxy site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => '', + 'installCommand' => '', + 'fallbackFile' => '', + ]); + + $this->assertEquals($site['headers']['status-code'], 201, 'Setup site failed with status code: ' . $site['headers']['status-code'] . ' and response: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); + + $siteId = $site['body']['$id']; + + // Deployment + $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]), [ + 'code' => $this->packageSite('static'), + 'activate' => 'true' + ]); + + $this->assertEquals($deployment['headers']['status-code'], 202, 'Setup deployment failed with status code: ' . $deployment['headers']['status-code'] . ' and response: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + $deploymentId = $deployment['body']['$id'] ?? ''; + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $site = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ])); + $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + return ['siteId' => $siteId, 'deploymentId' => $deploymentId]; + } + + protected function setupFunction(): mixed + { + // Function + $function = $this->client->call(Client::METHOD_POST, '/functions', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]), [ + 'functionId' => ID::unique(), + 'runtime' => 'node-18.0', + 'name' => 'Proxy Function', + 'entrypoint' => 'index.js', + 'commands' => '', + 'execute' => ['any'] + ]); + + $this->assertEquals($function['headers']['status-code'], 201, 'Setup function failed with status code: ' . $function['headers']['status-code'] . ' and response: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); + + $functionId = $function['body']['$id']; + + // Deployment + $deployment = $this->client->call(Client::METHOD_POST, '/functions/' . $functionId . '/deployments', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]), [ + 'code' => $this->packageFunction('node'), + 'activate' => 'true' + ]); + + $this->assertEquals($deployment['headers']['status-code'], 202, 'Setup deployment failed with status code: ' . $deployment['headers']['status-code'] . ' and response: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + $deploymentId = $deployment['body']['$id'] ?? ''; + + $this->assertEventually(function () use ($functionId, $deploymentId) { + $function = $this->client->call(Client::METHOD_GET, '/functions/' . $functionId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ])); + $this->assertEquals($deploymentId, $function['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($function['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + return ['functionId' => $functionId, 'deploymentId' => $deploymentId]; + } + + private function packageSite(string $site): CURLFile + { + $stdout = ''; + $stderr = ''; + + $folderPath = realpath(__DIR__ . '/../../../resources/sites') . "/$site"; + $tarPath = "$folderPath/code.tar.gz"; + + Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr); + + if (filesize($tarPath) > 1024 * 1024 * 5) { + throw new \Exception('Code package is too large. Use the chunked upload method instead.'); + } + + return new CURLFile($tarPath, 'application/x-gzip', \basename($tarPath)); + } + + private function packageFunction(string $function): CURLFile + { + $stdout = ''; + $stderr = ''; + + $folderPath = realpath(__DIR__ . '/../../../resources/functions') . "/$function"; + $tarPath = "$folderPath/code.tar.gz"; + + Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $stdout, $stderr); + + if (filesize($tarPath) > 1024 * 1024 * 5) { + throw new \Exception('Code package is too large. Use the chunked upload method instead.'); + } + + return new CURLFile($tarPath, 'application/x-gzip', \basename($tarPath)); + } +} diff --git a/tests/e2e/Services/Proxy/ProxyCustomServerTest.php b/tests/e2e/Services/Proxy/ProxyCustomServerTest.php new file mode 100644 index 0000000000..9a7ba74ec1 --- /dev/null +++ b/tests/e2e/Services/Proxy/ProxyCustomServerTest.php @@ -0,0 +1,516 @@ +<?php + +namespace Tests\E2E\Services\Proxy; + +use Tests\E2E\Client; +use Tests\E2E\Scopes\ProjectCustom; +use Tests\E2E\Scopes\Scope; +use Tests\E2E\Scopes\SideServer; +use Utopia\Database\Query; +use Utopia\System\System; + +class ProxyCustomServerTest extends Scope +{ + use ProxyBase; + use ProjectCustom; + use SideServer; + + public function testCreateRule(): void + { + $domain = \uniqid() . '-api.myapp.com'; + $rule = $this->createAPIRule($domain); + + $this->assertEquals(201, $rule['headers']['status-code']); + $this->assertEquals($domain, $rule['body']['domain']); + $this->assertEquals('manual', $rule['body']['trigger']); + $this->assertArrayHasKey('$id', $rule['body']); + $this->assertArrayHasKey('domain', $rule['body']); + $this->assertArrayHasKey('type', $rule['body']); + $this->assertArrayHasKey('redirectUrl', $rule['body']); + $this->assertArrayHasKey('redirectStatusCode', $rule['body']); + $this->assertArrayHasKey('deploymentResourceType', $rule['body']); + $this->assertArrayHasKey('deploymentId', $rule['body']); + $this->assertArrayHasKey('deploymentResourceId', $rule['body']); + $this->assertArrayHasKey('deploymentVcsProviderBranch', $rule['body']); + $this->assertArrayHasKey('logs', $rule['body']); + $this->assertArrayHasKey('renewAt', $rule['body']); + + $ruleId = $rule['body']['$id']; + + $rule = $this->createAPIRule($domain); + $this->assertEquals(409, $rule['headers']['status-code']); + + $rule = $this->deleteRule($ruleId); + + $this->assertEquals(204, $rule['headers']['status-code']); + } + + public function testCreateRuleSetup(): void + { + $ruleId = $this->setupAPIRule(\uniqid() . '-api2.myapp.com'); + $this->cleanupRule($ruleId); + } + + public function testCreateRuleApex(): void + { + $domain = \uniqid() . '.com'; + $rule = $this->createAPIRule($domain); + $this->assertEquals(201, $rule['headers']['status-code']); + $this->assertEquals('created', $rule['body']['status']); + } + + public function testCreateRuleVcs(): void + { + $domain = \uniqid() . '-vcs.myapp.com'; + + $setup = $this->setupSite(); + $siteId = $setup['siteId']; + $deploymentId = $setup['deploymentId']; + + $this->assertNotEmpty($siteId); + $this->assertNotEmpty($deploymentId); + + $rule = $this->createSiteRule('commit-' . $domain, $siteId); + $this->assertEquals(400, $rule['headers']['status-code']); + + $rule = $this->createSiteRule('branch-' . $domain, $siteId); + $this->assertEquals(400, $rule['headers']['status-code']); + + $rule = $this->createSiteRule('anything-' . $domain, $siteId); + $this->assertEquals(201, $rule['headers']['status-code']); + $this->cleanupRule($rule['body']['$id']); + } + + public function testCreateAPIRule(): void + { + $domain = \uniqid() . '-api.custom.localhost'; + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + // We should ideally assert 400, but server allows unknown domains, and serves API by default + $response = $proxyClient->call(Client::METHOD_GET, '/versions'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(APP_VERSION_STABLE, $response['body']['server']); + + $ruleId = $this->setupAPIRule($domain); + + $this->assertNotEmpty($ruleId); + + $response = $proxyClient->call(Client::METHOD_GET, '/versions'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(APP_VERSION_STABLE, $response['body']['server']); + + $this->cleanupRule($ruleId); + + $rule = $this->createAPIRule('http://' . $domain); + $this->assertEquals(400, $rule['headers']['status-code']); + + $rule = $this->createAPIRule('https://' . $domain); + $this->assertEquals(400, $rule['headers']['status-code']); + + // Unexpected I would say, but it is the current behaviour + $rule = $this->createAPIRule('wss://' . $domain); + $this->assertEquals(201, $rule['headers']['status-code']); + $this->cleanupRule($rule['body']['$id']); + + // Unexpected I would say, but it is the current behaviour + $rule = $this->createAPIRule($domain . '/some-path'); + $this->assertEquals(201, $rule['headers']['status-code']); + $this->cleanupRule($rule['body']['$id']); + } + + public function testCreateRedirectRule(): void + { + $domain = \uniqid() . '-redirect.custom.localhost'; + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://appwrite'); + $proxyClient->addHeader('x-appwrite-hostname', $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/todos/1'); + $this->assertEquals(404, $response['headers']['status-code']); + + $ruleId = $this->setupRedirectRule($domain, 'https://jsonplaceholder.typicode.com/todos/1', 301); + $this->assertNotEmpty($ruleId); + + $response = $proxyClient->call(Client::METHOD_GET, '/todos/1'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(1, $response['body']['id']); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals(1, $response['body']['id']); + + $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + $this->assertEquals('https://jsonplaceholder.typicode.com/todos/1', $response['headers']['location']); + + $domain = \uniqid() . '-redirect-307.custom.localhost'; + $ruleId = $this->setupRedirectRule($domain, 'https://jsonplaceholder.typicode.com/todos/1', 307); + $this->assertNotEmpty($ruleId); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://appwrite'); + $proxyClient->addHeader('x-appwrite-hostname', $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false); + $this->assertEquals(307, $response['headers']['status-code']); + $this->assertEquals('https://jsonplaceholder.typicode.com/todos/1', $response['headers']['location']); + + $this->cleanupRule($ruleId); + } + + public function testCreateFunctionRule(): void + { + $domain = \uniqid() . '-function.custom.localhost'; + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://appwrite'); + $proxyClient->addHeader('x-appwrite-hostname', $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/ping'); + $this->assertEquals(404, $response['headers']['status-code']); + + $setup = $this->setupFunction(); + $functionId = $setup['functionId']; + $deploymentId = $setup['deploymentId']; + + $this->assertNotEmpty($functionId); + $this->assertNotEmpty($deploymentId); + + $ruleId = $this->setupFunctionRule($domain, $functionId); + $this->assertNotEmpty($ruleId); + + $response = $proxyClient->call(Client::METHOD_GET, '/ping'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals($functionId, $response['body']['APPWRITE_FUNCTION_ID']); + + $this->cleanupRule($ruleId); + + $this->cleanupFunction($functionId); + + $this->assertEventually(function () use ($functionId, $deploymentId) { + $rules = $this->listRules([ + 'queries' => [ + Query::limit(1)->toString(), + Query::equal('type', ['deployment'])->toString(), + Query::equal('deploymentResourceType', ['function'])->toString(), + Query::equal('deploymentResourceId', [$functionId])->toString(), + ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(0, $rules['body']['total']); + $this->assertCount(0, $rules['body']['rules']); + + $rules = $this->listRules([ + 'queries' => [ + Query::limit(1)->toString(), + Query::equal('type', ['deployment'])->toString(), + Query::equal('deploymentId', [$deploymentId])->toString() + ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(0, $rules['body']['total']); + $this->assertCount(0, $rules['body']['rules']); + }); + } + + public function testCreateSiteRule(): void + { + $domain = \uniqid() . '-site.custom.localhost'; + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://appwrite'); + $proxyClient->addHeader('x-appwrite-hostname', $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact'); + $this->assertEquals(404, $response['headers']['status-code']); + + $setup = $this->setupSite(); + $siteId = $setup['siteId']; + $deploymentId = $setup['deploymentId']; + + $this->assertNotEmpty($siteId); + $this->assertNotEmpty($deploymentId); + + $ruleId = $this->setupSiteRule($domain, $siteId); + $this->assertNotEmpty($ruleId); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('Contact page', $response['body']); + + $rules = $this->listRules([ + 'queries' => [ + Query::limit(1)->toString(), + Query::equal('trigger', ['deployment'])->toString(), + Query::equal('type', ['deployment'])->toString(), + Query::equal('deploymentResourceType', ['site'])->toString(), + Query::equal('deploymentResourceId', [$siteId])->toString(), + ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertGreaterThan(0, $rules['body']['total']); + + $this->cleanupRule($ruleId); + + $this->cleanupSite($siteId); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $rules = $this->listRules([ + 'queries' => [ + Query::limit(1)->toString(), + Query::equal('type', ['deployment'])->toString(), + Query::equal('deploymentResourceType', ['site'])->toString(), + Query::equal('deploymentResourceId', [$siteId])->toString(), + ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(0, $rules['body']['total']); + $this->assertCount(0, $rules['body']['rules']); + + $rules = $this->listRules([ + 'queries' => [ + Query::limit(1)->toString(), + Query::equal('type', ['deployment'])->toString(), + Query::equal('deploymentId', [$deploymentId])->toString() + ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(0, $rules['body']['total']); + $this->assertCount(0, $rules['body']['rules']); + }); + } + + public function testCreateSiteBranchRule(): void + { + $domain = \uniqid() . '-site-branch.custom.localhost'; + + $setup = $this->setupSite(); + $siteId = $setup['siteId']; + $deploymentId = $setup['deploymentId']; + + $this->assertNotEmpty($siteId); + $this->assertNotEmpty($deploymentId); + + $ruleId = $this->setupSiteRule($domain, $siteId, 'dev'); + $this->assertNotEmpty($ruleId); + + $rule = $this->getRule($ruleId); + $this->assertEquals(200, $rule['headers']['status-code']); + + $this->cleanupRule($ruleId); + } + + public function testCreateFunctionBranchRule(): void + { + $domain = \uniqid() . '-function-branch.custom.localhost'; + + $setup = $this->setupFunction(); + $functionId = $setup['functionId']; + $deploymentId = $setup['deploymentId']; + + $this->assertNotEmpty($functionId); + $this->assertNotEmpty($deploymentId); + + $ruleId = $this->setupFunctionRule($domain, $functionId, 'dev'); + $this->assertNotEmpty($ruleId); + + $rule = $this->getRule($ruleId); + $this->assertEquals(200, $rule['headers']['status-code']); + + $this->cleanupRule($ruleId); + + $this->cleanupFunction($functionId); + } + + public function testUpdateRule(): void + { + // Create function appwrite-network domain + $domain = \uniqid() . '-cname-api.' . System::getEnv('_APP_DOMAIN_FUNCTIONS'); + + $rule = $this->createAPIRule($domain); + $this->assertEquals(201, $rule['headers']['status-code']); + $this->assertEquals('verified', $rule['body']['status']); + + $this->cleanupRule($rule['body']['$id']); + + // Create site appwrite-network domain + $domain = \uniqid() . '-cname-api.' . System::getEnv('_APP_DOMAIN_SITES'); + + $rule = $this->createAPIRule($domain); + $this->assertEquals(201, $rule['headers']['status-code']); + $this->assertEquals('verified', $rule['body']['status']); + + $this->cleanupRule($rule['body']['$id']); + + // Create + update + $domain = \uniqid() . '-cname-api.custom.com'; + + $rule = $this->createAPIRule($domain); + $this->assertEquals(201, $rule['headers']['status-code']); + $this->assertEquals('created', $rule['body']['status']); + + $ruleId = $rule['body']['$id']; + + $rule = $this->updateRuleVerification($ruleId); + $this->assertEquals(400, $rule['headers']['status-code']); + + $this->cleanupRule($ruleId); + } + + public function testGetRule() + { + $domain = \uniqid() . '-get.custom.localhost'; + $ruleId = $this->setupAPIRule($domain); + + $this->assertNotEmpty($ruleId); + + $rule = $this->getRule($ruleId); + $this->assertEquals(200, $rule['headers']['status-code']); + $this->assertEquals($domain, $rule['body']['domain']); + $this->assertEquals('manual', $rule['body']['trigger']); + $this->assertArrayHasKey('$id', $rule['body']); + $this->assertArrayHasKey('domain', $rule['body']); + $this->assertArrayHasKey('type', $rule['body']); + $this->assertArrayHasKey('redirectUrl', $rule['body']); + $this->assertArrayHasKey('redirectStatusCode', $rule['body']); + $this->assertArrayHasKey('deploymentResourceType', $rule['body']); + $this->assertArrayHasKey('deploymentId', $rule['body']); + $this->assertArrayHasKey('deploymentResourceId', $rule['body']); + $this->assertArrayHasKey('deploymentVcsProviderBranch', $rule['body']); + $this->assertArrayHasKey('logs', $rule['body']); + $this->assertArrayHasKey('renewAt', $rule['body']); + + $this->cleanupRule($ruleId); + } + + public function testListRules() + { + $rules = $this->listRules(); + $this->assertEquals(200, $rules['headers']['status-code']); + foreach ($rules['body']['rules'] as $rule) { + $rule = $this->deleteRule($rule['$id']); + $this->assertEquals(204, $rule['headers']['status-code']); + } + + $rules = $this->listRules(); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(0, $rules['body']['total']); + $this->assertCount(0, $rules['body']['rules']); + + $rule1Domain = \uniqid() . '-list1.custom.localhost'; + $rule1Id = $this->setupAPIRule($rule1Domain); + $this->assertNotEmpty($rule1Id); + + $rules = $this->listRules(); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(1, $rules['body']['total']); + $this->assertCount(1, $rules['body']['rules']); + $this->assertEquals($rule1Domain, $rules['body']['rules'][0]['domain']); + + $this->assertEquals('manual', $rules['body']['rules'][0]['trigger']); + $this->assertArrayHasKey('$id', $rules['body']['rules'][0]); + $this->assertArrayHasKey('domain', $rules['body']['rules'][0]); + $this->assertArrayHasKey('type', $rules['body']['rules'][0]); + $this->assertArrayHasKey('redirectUrl', $rules['body']['rules'][0]); + $this->assertArrayHasKey('redirectStatusCode', $rules['body']['rules'][0]); + $this->assertArrayHasKey('deploymentResourceType', $rules['body']['rules'][0]); + $this->assertArrayHasKey('deploymentId', $rules['body']['rules'][0]); + $this->assertArrayHasKey('deploymentResourceId', $rules['body']['rules'][0]); + $this->assertArrayHasKey('deploymentVcsProviderBranch', $rules['body']['rules'][0]); + $this->assertArrayHasKey('logs', $rules['body']['rules'][0]); + $this->assertArrayHasKey('renewAt', $rules['body']['rules'][0]); + + $rule2Domain = \uniqid() . '-list1.custom.localhost'; + $rule2Id = $this->setupAPIRule($rule2Domain); + $this->assertNotEmpty($rule2Id); + + $rules = $this->listRules(); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(2, $rules['body']['total']); + $this->assertCount(2, $rules['body']['rules']); + + $rules = $this->listRules([ + 'queries' => [ + Query::limit(1)->toString() + ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(2, $rules['body']['total']); + $this->assertCount(1, $rules['body']['rules']); + + $rules = $this->listRules([ + 'queries' => [ + Query::equal('$id', [$rule1Id])->toString() + ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertCount(1, $rules['body']['rules']); + $this->assertEquals($rule1Domain, $rules['body']['rules'][0]['domain']); + + $rules = $this->listRules([ + 'queries' => [ + Query::orderDesc('$id')->toString() + ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertCount(2, $rules['body']['rules']); + $this->assertEquals($rule2Id, $rules['body']['rules'][0]['$id']); + + $rules = $this->listRules([ + 'queries' => [ + Query::equal('domain', [$rule2Domain])->toString() + ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertCount(1, $rules['body']['rules']); + $this->assertEquals($rule2Id, $rules['body']['rules'][0]['$id']); + + $rules = $this->listRules([ + 'search' => $rule1Domain, + 'queries' => [ Query::orderDesc('$createdAt') ] + ]); + + $this->assertEquals(200, $rules['headers']['status-code']); + $ruleIds = \array_column($rules['body']['rules'], '$id'); + $this->assertContains($rule1Id, $ruleIds); + + $rules = $this->listRules([ + 'search' => $rule2Domain, + 'queries' => [ Query::orderDesc('$createdAt') ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $ruleIds = \array_column($rules['body']['rules'], '$id'); + $this->assertContains($rule2Id, $ruleIds); + + $rules = $this->listRules([ + 'search' => $rule1Id, + 'queries' => [ Query::orderDesc('$createdAt') ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $ruleDomains = \array_column($rules['body']['rules'], 'domain'); + $this->assertContains($rule1Domain, $ruleDomains); + + $rules = $this->listRules([ + 'search' => $rule2Id, + 'queries' => [ Query::orderDesc('$createdAt') ] + ]); + $this->assertEquals(200, $rules['headers']['status-code']); + $ruleDomains = \array_column($rules['body']['rules'], 'domain'); + $this->assertContains($rule2Domain, $ruleDomains); + + $rules = $this->listRules(); + $this->assertEquals(200, $rules['headers']['status-code']); + foreach ($rules['body']['rules'] as $rule) { + $rule = $this->deleteRule($rule['$id']); + $this->assertEquals(204, $rule['headers']['status-code']); + } + + $rules = $this->listRules(); + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(0, $rules['body']['total']); + $this->assertCount(0, $rules['body']['rules']); + } +} diff --git a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php index 0155d251f2..ba2d18694a 100644 --- a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php @@ -534,10 +534,11 @@ class RealtimeConsoleClientTest extends Scope 'timeout' => 10 ]); - $functionId = $response1['body']['$id'] ?? ''; - $this->assertEquals(201, $response1['headers']['status-code']); + $functionId = $response1['body']['$id']; + $this->assertNotEmpty($functionId); + $projectId = 'console'; $client = $this->getWebsocket(['console'], [ @@ -570,6 +571,9 @@ class RealtimeConsoleClientTest extends Scope $this->assertEquals(202, $deployment['headers']['status-code']); + $deploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId); + $response = json_decode($client->receive(), true); $this->assertArrayHasKey('type', $response); @@ -580,8 +584,55 @@ class RealtimeConsoleClientTest extends Scope $this->assertCount(2, $response['data']['channels']); $this->assertContains('console', $response['data']['channels']); $this->assertContains("projects.{$projectId}", $response['data']['channels']); - // $this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.create", $response['data']['events']); TODO @christyjacob4 : enable test once we allow functions.* events - $this->assertNotEmpty($response['data']['payload']); + $this->assertEquals("waiting", $response['data']['payload']['status']); + $this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.create", $response['data']['events']); + + $response = json_decode($client->receive(), true); + $this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.update", $response['data']['events']); + $this->assertContains('console', $response['data']['channels']); + $this->assertContains("projects.{$projectId}", $response['data']['channels']); + $this->assertEquals("processing", $response['data']['payload']['status']); + + $response = json_decode($client->receive(), true); + $this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.update", $response['data']['events']); + $this->assertContains('console', $response['data']['channels']); + $this->assertContains("projects.{$projectId}", $response['data']['channels']); + $this->assertEquals("building", $response['data']['payload']['status']); + + $previousBuildLogs = null; + while (true) { + $response = json_decode($client->receive(), true); + $this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.update", $response['data']['events']); + $this->assertContains('console', $response['data']['channels']); + $this->assertContains("projects.{$projectId}", $response['data']['channels']); + $this->assertArrayHasKey('buildLogs', $response['data']['payload']); + + if (!empty($response['data']['payload']['buildEndedAt'])) { + $this->assertNotEmpty($response['data']['payload']['buildEndedAt']); + $this->assertNotEmpty($response['data']['payload']['buildStartedAt']); + $this->assertNotEmpty($response['data']['payload']['buildDuration']); + $this->assertNotEmpty($response['data']['payload']['buildPath']); + $this->assertNotEmpty($response['data']['payload']['buildSize']); + $this->assertNotEmpty($response['data']['payload']['totalSize']); + $this->assertNotEmpty($response['data']['payload']['buildLogs']); + break; + } + + // Ignore comparasion for first payload + if ($previousBuildLogs !== null) { + $this->assertNotEquals($previousBuildLogs, $response['data']['payload']['buildLogs']); + } + + $previousBuildLogs = $response['data']['payload']['buildLogs']; + + $this->assertEquals('building', $response['data']['payload']['status']); + } + + $response = json_decode($client->receive(), true); + $this->assertContains("functions.{$functionId}.deployments.{$deploymentId}.update", $response['data']['events']); + $this->assertContains('console', $response['data']['channels']); + $this->assertContains("projects.{$projectId}", $response['data']['channels']); + $this->assertEquals("ready", $response['data']['payload']['status']); $client->close(); } diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php new file mode 100644 index 0000000000..00edcc1b72 --- /dev/null +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -0,0 +1,437 @@ +<?php + +namespace Tests\E2E\Services\Sites; + +use Appwrite\Tests\Async; +use CURLFile; +use Tests\E2E\Client; +use Utopia\CLI\Console; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Query; +use Utopia\System\System; + +trait SitesBase +{ + use Async; + + protected string $stdout = ''; + protected string $stderr = ''; + + protected function setupSite(mixed $params): string + { + $site = $this->client->call(Client::METHOD_POST, '/sites', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]), $params); + + $this->assertEquals($site['headers']['status-code'], 201, 'Setup site failed with status code: ' . $site['headers']['status-code'] . ' and response: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); + + $siteId = $site['body']['$id']; + + return $siteId; + } + + protected function setupDeployment(string $siteId, mixed $params): string + { + $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]), $params); + $this->assertEquals($deployment['headers']['status-code'], 202, 'Setup deployment failed with status code: ' . $deployment['headers']['status-code'] . ' and response: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + $deploymentId = $deployment['body']['$id'] ?? ''; + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ])); + $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + }, 150000, 500); + + // Not === so multipart/form-data works fine too + if (($params['activate'] ?? false) == true) { + $this->assertEventually(function () use ($siteId, $deploymentId) { + $site = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ])); + $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + } + + return $deploymentId; + } + + protected function cleanupSite(string $siteId): void + { + $site = $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ])); + + $this->assertEquals($site['headers']['status-code'], 204); + } + + protected function cleanupDeployment(string $siteId, string $deploymentId): void + { + $deployment = $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId . '/deployments/' . $deploymentId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ])); + + $this->assertEquals($deployment['headers']['status-code'], 204); + } + + protected function createSite(mixed $params): mixed + { + $site = $this->client->call(Client::METHOD_POST, '/sites', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $site; + } + + protected function updateSite(mixed $params): mixed + { + $site = $this->client->call(Client::METHOD_PUT, '/sites/' . $params['$id'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $site; + } + + protected function createVariable(string $siteId, mixed $params): mixed + { + $variable = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/variables', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $variable; + } + + protected function getVariable(string $siteId, string $variableId): mixed + { + $variable = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/variables/' . $variableId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $variable; + } + + protected function listVariables(string $siteId, mixed $params = []): mixed + { + $variables = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/variables', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $variables; + } + + protected function updateVariable(string $siteId, string $variableId, mixed $params): mixed + { + $variable = $this->client->call(Client::METHOD_PUT, '/sites/' . $siteId . '/variables/' . $variableId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $variable; + } + + protected function deleteVariable(string $siteId, string $variableId): mixed + { + $variable = $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId . '/variables/' . $variableId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $variable; + } + + protected function getSite(string $siteId): mixed + { + $site = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $site; + } + + protected function getDeployment(string $siteId, string $deploymentId): mixed + { + $deployment = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $deployment; + } + + protected function getLog(string $siteId, $logId): mixed + { + $log = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/logs/' . $logId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $log; + } + + protected function listSites(mixed $params = []): mixed + { + $sites = $this->client->call(Client::METHOD_GET, '/sites', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $sites; + } + + protected function listDeployments(string $siteId, $params = []): mixed + { + $deployments = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $deployments; + } + + protected function listLogs(string $siteId, array $queries = []): mixed + { + $logs = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/logs', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => $queries + ]); + + return $logs; + } + + protected function packageSite(string $site): CURLFile + { + $folderPath = realpath(__DIR__ . '/../../../resources/sites') . "/$site"; + $tarPath = "$folderPath/code.tar.gz"; + + Console::execute("cd $folderPath && tar --exclude code.tar.gz -czf code.tar.gz .", '', $this->stdout, $this->stderr); + + if (filesize($tarPath) > 1024 * 1024 * 5) { + throw new \Exception('Code package is too large. Use the chunked upload method instead.'); + } + + return new CURLFile($tarPath, 'application/x-gzip', \basename($tarPath)); + } + + protected function createDeployment(string $siteId, mixed $params = []): mixed + { + $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $deployment; + } + + protected function deleteDeployment(string $siteId, string $deploymentId): mixed + { + $deployment = $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId . '/deployments/' . $deploymentId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), []); + + return $deployment; + } + + protected function setupDuplicateDeployment(string $siteId, string $deploymentId): string + { + $deployment = $this->createDuplicateDeployment($siteId, $deploymentId); + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $site = $this->getSite($siteId); + $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + return $deploymentId; + } + + protected function createDuplicateDeployment(string $siteId, string $deploymentId): mixed + { + $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments/duplicate', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'deploymentId' => $deploymentId, + ]); + + return $deployment; + } + + protected function createTemplateDeployment(string $siteId, mixed $params = []): mixed + { + $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments/template', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $deployment; + } + + protected function getUsage(string $siteId, mixed $params): mixed + { + $usage = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/usage', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), $params); + + return $usage; + } + + protected function getTemplate(string $templateId) + { + $template = $this->client->call(Client::METHOD_GET, '/sites/templates/' . $templateId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]); + return $template; + } + + protected function deleteSite(string $siteId): mixed + { + $site = $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $site; + } + + protected function setupSiteDomain(string $siteId, string $subdomain = ''): string + { + $subdomain = $subdomain ? $subdomain : ID::unique(); + $rule = $this->client->call(Client::METHOD_POST, '/proxy/rules/site', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'domain' => $subdomain . '.' . System::getEnv('_APP_DOMAIN_SITES', ''), + 'siteId' => $siteId, + ]); + + $this->assertEquals(201, $rule['headers']['status-code']); + $this->assertNotEmpty($rule['body']['$id']); + $this->assertNotEmpty($rule['body']['domain']); + + $domain = $rule['body']['domain']; + + return $domain; + } + + protected function getSiteDomain(string $siteId): string + { + $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('deploymentResourceId', [$siteId])->toString(), + Query::equal('trigger', ['manual'])->toString(), + Query::equal('type', ['deployment'])->toString(), + ], + ]); + + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertGreaterThanOrEqual(1, $rules['body']['total']); + $this->assertGreaterThanOrEqual(1, \count($rules['body']['rules'])); + $this->assertNotEmpty($rules['body']['rules'][0]['domain']); + + $domain = $rules['body']['rules'][0]['domain']; + + return $domain; + } + + protected function getDeploymentDomain(string $deploymentId): string + { + $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('deploymentId', [$deploymentId])->toString(), + Query::equal('type', ['deployment'])->toString(), + Query::equal('trigger', ['deployment'])->toString(), + ], + ]); + + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertGreaterThanOrEqual(1, $rules['body']['total']); + $this->assertGreaterThanOrEqual(1, \count($rules['body']['rules'])); + $this->assertNotEmpty($rules['body']['rules'][0]['domain']); + + $domain = $rules['body']['rules'][0]['domain']; + + return $domain; + } + + protected function getDeploymentDownload(string $siteId, string $deploymentId, string $type): mixed + { + $response = $this->client->call(Client::METHOD_GET, '/sites/' . $siteId . '/deployments/' . $deploymentId . '/download', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'type' => $type, + ]); + + return $response; + } + + protected function updateSiteDeployment(string $siteId, string $deploymentId): mixed + { + $site = $this->client->call(Client::METHOD_PATCH, '/sites/' . $siteId . '/deployment', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'deploymentId' => $deploymentId + ]); + + return $site; + } + + protected function cancelDeployment(string $siteId, string $deploymentId): mixed + { + $deployment = $this->client->call(Client::METHOD_PATCH, '/sites/' . $siteId . '/deployments/' . $deploymentId . '/status', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $deployment; + } + + protected function listSpecifications(): mixed + { + $specifications = $this->client->call(Client::METHOD_GET, '/sites/specifications', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + return $specifications; + } +} diff --git a/tests/e2e/Services/Sites/SitesConsoleClientTest.php b/tests/e2e/Services/Sites/SitesConsoleClientTest.php new file mode 100644 index 0000000000..1a84f46ed7 --- /dev/null +++ b/tests/e2e/Services/Sites/SitesConsoleClientTest.php @@ -0,0 +1,100 @@ +<?php + +namespace Tests\E2E\Services\Sites; + +use Tests\E2E\Client; +use Tests\E2E\Scopes\ProjectCustom; +use Tests\E2E\Scopes\Scope; +use Tests\E2E\Scopes\SideConsole; +use Utopia\Database\Helpers\ID; + +class SitesConsoleClientTest extends Scope +{ + use ProjectCustom; + use SideConsole; + use SitesBase; + + public function testSiteScreenshot(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Themed site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => '', + 'installCommand' => '', + 'fallbackFile' => '', + ]); + + $this->assertNotEmpty($siteId); + + $domain = $this->setupSiteDomain($siteId); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static-themed'), + 'activate' => 'true' + ]); + + $this->assertNotEmpty($deploymentId); + + $domain = $this->getSiteDomain($siteId); + $this->assertNotEmpty($domain); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Themed website", $response['body']); + $this->assertStringContainsString("@media (prefers-color-scheme: dark)", $response['body']); + + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['screenshotLight']); + $this->assertNotEmpty($deployment['body']['screenshotDark']); + + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deployment['body']['screenshotLight'], $site['body']['deploymentScreenshotLight']); + $this->assertEquals($deployment['body']['screenshotDark'], $site['body']['deploymentScreenshotDark']); + + $screenshotId = $deployment['body']['screenshotLight']; + $file = $this->client->call(Client::METHOD_GET, "/storage/buckets/screenshots/files/$screenshotId/view?project=console", array_merge($this->getHeaders(), [ + 'x-appwrite-mode' => 'default' // NOT ADMIN! + ])); + + $this->assertEquals(200, $file['headers']['status-code']); + $this->assertNotEmpty(200, $file['body']); + $this->assertGreaterThan(1, $file['headers']['content-length']); + $this->assertEquals('image/png', $file['headers']['content-type']); + + $screenshotHash = \md5($file['body']); + $this->assertNotEmpty($screenshotHash); + + $screenshotId = $deployment['body']['screenshotDark']; + $file = $this->client->call(Client::METHOD_GET, "/storage/buckets/screenshots/files/$screenshotId/view?project=console", array_merge($this->getHeaders(), [ + 'x-appwrite-mode' => 'default' // NOT ADMIN! + ])); + + $this->assertEquals(200, $file['headers']['status-code']); + $this->assertNotEmpty(200, $file['body']); + $this->assertGreaterThan(1, $file['headers']['content-length']); + $this->assertEquals('image/png', $file['headers']['content-type']); + + $screenshotDarkHash = \md5($file['body']); + $this->assertNotEmpty($screenshotDarkHash); + + $this->assertNotEquals($screenshotDarkHash, $screenshotHash); + + $file = $this->client->call(Client::METHOD_GET, "/storage/buckets/screenshots/files/$screenshotId/view?project=console"); + $this->assertEquals(404, $file['headers']['status-code']); + + $file = $this->client->call(Client::METHOD_GET, "/storage/buckets/screenshots/files/$screenshotId/view?project=console"); + $this->assertEquals(404, $file['headers']['status-code']); + + $this->cleanupSite($siteId); + } +} diff --git a/tests/e2e/Services/Sites/SitesCustomClientTest.php b/tests/e2e/Services/Sites/SitesCustomClientTest.php new file mode 100644 index 0000000000..9bf389ea62 --- /dev/null +++ b/tests/e2e/Services/Sites/SitesCustomClientTest.php @@ -0,0 +1,141 @@ +<?php + +namespace Tests\E2E\Services\Sites; + +use Tests\E2E\Client; +use Tests\E2E\Scopes\ProjectCustom; +use Tests\E2E\Scopes\Scope; +use Tests\E2E\Scopes\SideClient; + +class SitesCustomClientTest extends Scope +{ + use SitesBase; + use ProjectCustom; + use SideClient; + + public function testListTemplates() + { + /** + * Test for SUCCESS + */ + // List all templates + $templates = $this->client->call(Client::METHOD_GET, '/sites/templates', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(200, $templates['headers']['status-code']); + $this->assertGreaterThan(0, $templates['body']['total']); + $this->assertIsArray($templates['body']['templates']); + + foreach ($templates['body']['templates'] as $template) { + $this->assertArrayHasKey('name', $template); + $this->assertArrayHasKey('key', $template); + $this->assertArrayHasKey('useCases', $template); + $this->assertArrayHasKey('vcsProvider', $template); + $this->assertArrayHasKey('frameworks', $template); + $this->assertArrayHasKey('variables', $template); + $this->assertArrayHasKey('screenshotDark', $template); + $this->assertArrayHasKey('screenshotLight', $template); + $this->assertArrayHasKey('tagline', $template); + } + + // List templates with pagination + $templatesOffset = $this->client->call(Client::METHOD_GET, '/sites/templates', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'limit' => 1, + 'offset' => 2 + ]); + $this->assertEquals(200, $templatesOffset['headers']['status-code']); + $this->assertCount(1, $templatesOffset['body']['templates']); + $this->assertEquals($templates['body']['templates'][2]['key'], $templatesOffset['body']['templates'][0]['key']); + + // List templates with filters + $templates = $this->client->call(Client::METHOD_GET, '/sites/templates', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'useCases' => ['starter'], + 'frameworks' => ['nuxt'] + ]); + $this->assertEquals(200, $templates['headers']['status-code']); + $this->assertGreaterThan(0, $templates['body']['total']); + $this->assertIsArray($templates['body']['templates']); + foreach ($templates['body']['templates'] as $template) { + $this->assertContains($template['useCases'][0], ['starter']); + } + $this->assertArrayHasKey('frameworks', $templates['body']['templates'][0]); + $this->assertContains('Nuxt', array_column($templates['body']['templates'][0]['frameworks'], 'name')); + + // List templates with pagination and filters + $templates = $this->client->call(Client::METHOD_GET, '/sites/templates', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'limit' => 5, + 'offset' => 0, + 'useCases' => ['starter'], + 'frameworks' => ['nextjs'] + ]); + + $this->assertEquals(200, $templates['headers']['status-code']); + $this->assertGreaterThan(0, $templates['body']['total']); + $this->assertIsArray($templates['body']['templates']); + $this->assertArrayHasKey('frameworks', $templates['body']['templates'][0]); + + foreach ($templates['body']['templates'] as $template) { + $this->assertContains($template['useCases'][0], ['starter']); + } + + $this->assertContains('Next.js', array_column($templates['body']['templates'][0]['frameworks'], 'name')); + + /** + * Test for FAILURE + */ + // List templates with invalid limit + $templates = $this->client->call(Client::METHOD_GET, '/sites/templates', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'limit' => 5001, + 'offset' => 10, + ]); + $this->assertEquals(400, $templates['headers']['status-code']); + + // List templates with invalid offset + $templates = $this->client->call(Client::METHOD_GET, '/sites/templates', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'limit' => 5, + 'offset' => 5001, + ]); + $this->assertEquals(400, $templates['headers']['status-code']); + } + + public function testGetTemplate() + { + /** + * Test for SUCCESS + */ + $template = $this->getTemplate('starter-for-react'); + $this->assertEquals(200, $template['headers']['status-code']); + $this->assertIsArray($template['body']); + $this->assertEquals('starter-for-react', $template['body']['key']); + $this->assertEquals('React starter', $template['body']['name']); + $this->assertEquals(['starter'], $template['body']['useCases']); + $this->assertEquals('github', $template['body']['vcsProvider']); + $this->assertEquals('Simple React application integrated with Appwrite SDK.', $template['body']['tagline']); + $this->assertIsArray($template['body']['frameworks']); + $this->assertEquals('http://localhost/images/sites/templates/starter-for-react-dark.png', $template['body']['screenshotDark']); + $this->assertEquals('http://localhost/images/sites/templates/starter-for-react-light.png', $template['body']['screenshotLight']); + + /** + * Test for FAILURE + */ + $template = $this->getTemplate('invalid-template-id'); + $this->assertEquals(404, $template['headers']['status-code']); + } +} diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php new file mode 100644 index 0000000000..dd4efa5932 --- /dev/null +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -0,0 +1,2654 @@ +<?php + +namespace Tests\E2E\Services\Sites; + +use Ahc\Jwt\JWT; +use Appwrite\Platform\Modules\Compute\Specification; +use Appwrite\Tests\Retry; +use Tests\E2E\Client; +use Tests\E2E\Scopes\ProjectCustom; +use Tests\E2E\Scopes\Scope; +use Tests\E2E\Scopes\SideServer; +use Utopia\CLI\Console; +use Utopia\Database\Document; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Query; +use Utopia\Database\Validator\Datetime as DatetimeValidator; +use Utopia\System\System; + +class SitesCustomServerTest extends Scope +{ + use SitesBase; + use ProjectCustom; + use SideServer; + + public function testListSpecs(): void + { + $specifications = $this->listSpecifications(); + $this->assertEquals(200, $specifications['headers']['status-code']); + $this->assertGreaterThan(0, $specifications['body']['total']); + $this->assertArrayHasKey(0, $specifications['body']['specifications']); + $this->assertArrayHasKey('memory', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('cpus', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('enabled', $specifications['body']['specifications'][0]); + $this->assertArrayHasKey('slug', $specifications['body']['specifications'][0]); + + $site = $this->createSite([ + 'buildRuntime' => 'node-22', + 'framework' => 'other', + 'name' => 'Specs site', + 'siteId' => ID::unique(), + 'specification' => $specifications['body']['specifications'][0]['slug'] + ]); + $this->assertEquals(201, $site['headers']['status-code']); + $this->assertEquals($specifications['body']['specifications'][0]['slug'], $site['body']['specification']); + + $site = $this->getSite($site['body']['$id']); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($specifications['body']['specifications'][0]['slug'], $site['body']['specification']); + + $this->cleanupSite($site['body']['$id']); + + $site = $this->createSite([ + 'buildRuntime' => 'node-22', + 'framework' => 'other', + 'name' => 'Specs site', + 'siteId' => ID::unique(), + 'specification' => 'cheap-please' + ]); + $this->assertEquals(400, $site['headers']['status-code']); + } + + public function testCreateSite(): void + { + /** + * Test for SUCCESS + */ + $site = $this->createSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'siteId' => ID::unique() + ]); + + $siteId = $site['body']['$id'] ?? ''; + + $dateValidator = new DateTimeValidator(); + $this->assertEquals(201, $site['headers']['status-code']); + $this->assertNotEmpty($site['body']['$id']); + $this->assertEquals('Test Site', $site['body']['name']); + $this->assertEquals('other', $site['body']['framework']); + $this->assertEquals(true, $dateValidator->isValid($site['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($site['body']['$updatedAt'])); + $this->assertEquals('node-22', $site['body']['buildRuntime']); + $this->assertEquals(null, $site['body']['fallbackFile']); + $this->assertEquals('./', $site['body']['outputDirectory']); + + $variable = $this->createVariable($siteId, [ + 'key' => 'siteKey1', + 'value' => 'siteValue1', + ]); + $variable2 = $this->createVariable($siteId, [ + 'key' => 'siteKey2', + 'value' => 'siteValue2', + ]); + $variable3 = $this->createVariable($siteId, [ + 'key' => 'siteKey3', + 'value' => 'siteValue3', + ]); + + $this->assertEquals(201, $variable['headers']['status-code']); + $this->assertEquals(201, $variable2['headers']['status-code']); + $this->assertEquals(201, $variable3['headers']['status-code']); + + $this->cleanupSite($siteId); + } + + public function testConsoleAvailabilityEndpoint(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Test Site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './', + 'fallbackFile' => '', + ]); + + $this->assertNotEmpty($siteId); + + $domain = $this->setupSiteDomain($siteId); + + $response = $this->client->call(Client::METHOD_GET, '/console/resources', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + 'x-appwrite-project' => 'console', + ], [ + 'type' => 'rules', + 'value' => $domain, + ]); + + $this->assertEquals(409, $response['headers']['status-code']); // domain unavailable + + $nonExistingDomain = "non-existent-subdomain.sites.localhost"; + + $response = $this->client->call(Client::METHOD_GET, '/console/resources', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + 'x-appwrite-project' => 'console', + ], [ + 'type' => 'rules', + 'value' => $nonExistingDomain, + ]); + + $this->assertEquals(204, $response['headers']['status-code']); // domain available + + $this->cleanupSite($siteId); + + $this->assertEventually(function () use ($siteId) { + $rule = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('deploymentResourceId', [$siteId]) + ] + ]); + + $this->assertEquals(200, $rule['headers']['status-code']); + $this->assertEquals(0, $rule['body']['total']); + }, 5000, 500); + + $response = $this->client->call(Client::METHOD_GET, '/console/resources', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => 'a_session_console=' . $this->getRoot()['session'], + 'x-appwrite-project' => 'console', + ], [ + 'type' => 'rules', + 'value' => $domain, + ]); + + $this->assertEquals(204, $response['headers']['status-code']); // domain available as site is deleted + } + + public function testVariables(): void + { + $site = $this->createSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'siteId' => ID::unique() + ]); + + $siteId = $site['body']['$id'] ?? ''; + + $this->assertEquals(201, $site['headers']['status-code']); + $this->assertNotEmpty($site['body']['$id']); + $this->assertEquals('Test Site', $site['body']['name']); + + $variable = $this->createVariable($siteId, [ + 'key' => 'siteKey1', + 'value' => 'siteValue1', + 'secret' => false, + ]); + + $this->assertEquals(201, $variable['headers']['status-code']); + $this->assertNotEmpty($variable['body']['$id']); + $this->assertEquals('siteKey1', $variable['body']['key']); + $this->assertEquals('siteValue1', $variable['body']['value']); + $this->assertEquals(false, $variable['body']['secret']); + + $variable2 = $this->createVariable($siteId, [ + 'key' => 'siteKey2', + 'value' => 'siteValue2', + 'secret' => false, + ]); + + $this->assertEquals(201, $variable2['headers']['status-code']); + $this->assertNotEmpty($variable2['body']['$id']); + $this->assertEquals('siteKey2', $variable2['body']['key']); + $this->assertEquals('siteValue2', $variable2['body']['value']); + $this->assertEquals(false, $variable2['body']['secret']); + + $secretVariable = $this->createVariable($siteId, [ + 'key' => 'siteKey3', + 'value' => 'siteValue3', + 'secret' => true, + ]); + + $this->assertEquals(201, $secretVariable['headers']['status-code']); + $this->assertNotEmpty($secretVariable['body']['$id']); + $this->assertEquals('siteKey3', $secretVariable['body']['key']); + $this->assertEquals('', $secretVariable['body']['value']); + $this->assertEquals(true, $secretVariable['body']['secret']); + + $variable = $this->getVariable($siteId, $variable['body']['$id']); + + $this->assertEquals(200, $variable['headers']['status-code']); + $this->assertNotEmpty($variable['body']['$id']); + $this->assertEquals('siteKey1', $variable['body']['key']); + $this->assertEquals('siteValue1', $variable['body']['value']); + $this->assertEquals(false, $variable['body']['secret']); + + $secretVariable = $this->getVariable($siteId, $secretVariable['body']['$id']); + + $this->assertEquals(200, $secretVariable['headers']['status-code']); + $this->assertNotEmpty($secretVariable['body']['$id']); + $this->assertEquals('siteKey3', $secretVariable['body']['key']); + $this->assertEquals('', $secretVariable['body']['value']); + $this->assertEquals(true, $secretVariable['body']['secret']); + + $variable = $this->updateVariable($siteId, $variable['body']['$id'], [ + 'key' => 'siteKey1Updated', + 'value' => 'siteValue1Updated', + ]); + + $this->assertEquals(200, $variable['headers']['status-code']); + $this->assertNotEmpty($variable['body']['$id']); + $this->assertEquals('siteKey1Updated', $variable['body']['key']); + $this->assertEquals('siteValue1Updated', $variable['body']['value']); + $this->assertEquals(false, $variable['body']['secret']); + + $variable = $this->updateVariable($siteId, $variable['body']['$id'], [ + 'key' => 'siteKey1Updated', + 'secret' => true, + ]); + + $this->assertEquals(200, $variable['headers']['status-code']); + $this->assertNotEmpty($variable['body']['$id']); + $this->assertEquals('siteKey1Updated', $variable['body']['key']); + $this->assertEquals('', $variable['body']['value']); + $this->assertEquals(true, $variable['body']['secret']); + + $secretVariable = $this->updateVariable($siteId, $secretVariable['body']['$id'], [ + 'key' => 'siteKey3', + 'value' => 'siteValue3Updated', + ]); + + $this->assertEquals(200, $secretVariable['headers']['status-code']); + $this->assertNotEmpty($secretVariable['body']['$id']); + $this->assertEquals('siteKey3', $secretVariable['body']['key']); + $this->assertEquals('', $secretVariable['body']['value']); + $this->assertEquals(true, $secretVariable['body']['secret']); + + $response = $this->updateVariable($siteId, $secretVariable['body']['$id'], [ + 'key' => 'siteKey3', + 'secret' => false, + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + $secretVariable = $this->getVariable($siteId, $secretVariable['body']['$id']); + + $this->assertEquals(200, $secretVariable['headers']['status-code']); + $this->assertNotEmpty($secretVariable['body']['$id']); + $this->assertEquals('siteKey3', $secretVariable['body']['key']); + $this->assertEquals('', $secretVariable['body']['value']); + $this->assertEquals(true, $secretVariable['body']['secret']); + + $variables = $this->listVariables($siteId); + + $this->assertEquals(200, $variables['headers']['status-code']); + $this->assertCount(3, $variables['body']['variables']); + + $response = $this->deleteVariable($siteId, $variable['body']['$id']); + $this->assertEquals(204, $response['headers']['status-code']); + $response = $this->deleteVariable($siteId, $variable2['body']['$id']); + $this->assertEquals(204, $response['headers']['status-code']); + $response = $this->deleteVariable($siteId, $secretVariable['body']['$id']); + $this->assertEquals(204, $response['headers']['status-code']); + + $variables = $this->listVariables($siteId); + + $this->assertEquals(200, $variables['headers']['status-code']); + $this->assertCount(0, $variables['body']['variables']); + + $this->cleanupSite($siteId); + } + + // This is first Sites test with Proxy + // If this fails, it may not be related to variables; but Router flow failing + public function testVariablesE2E(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Astro site', + 'framework' => 'astro', + 'adapter' => 'ssr', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'fallbackFile' => '', + ]); + + $this->assertNotEmpty($siteId); + + $domain = $this->setupSiteDomain($siteId); + + $secretVariable = $this->createVariable($siteId, [ + 'key' => 'name', + 'value' => 'Appwrite', + ]); + + $this->assertEquals(201, $secretVariable['headers']['status-code']); + $this->assertNotEmpty($secretVariable['body']['$id']); + $this->assertEquals('name', $secretVariable['body']['key']); + $this->assertEquals('', $secretVariable['body']['value']); + $this->assertEquals(true, $secretVariable['body']['secret']); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('astro'), + 'activate' => 'true' + ]); + + $this->assertNotEmpty($deploymentId); + + $domain = $this->getSiteDomain($siteId); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Env variable is Appwrite", $response['body']); + $this->assertStringNotContainsString("Variable not found", $response['body']); + + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['sourceSize']); + $this->assertGreaterThan(0, $deployment['body']['buildSize']); + $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; + $this->assertEquals($totalSize, $deployment['body']['totalSize']); + + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertNotEmpty($site['body']['deploymentId']); + $this->assertNotEmpty($site['body']['deploymentCreatedAt']); + $this->assertEquals($deployment['body']['$id'], $site['body']['deploymentId']); + $this->assertEquals($deployment['body']['$createdAt'], $site['body']['deploymentCreatedAt']); + + $this->cleanupSite($siteId); + } + + public function testAdapterDetectionAstroSSR(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Astro SSR site', + 'framework' => 'astro', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + ]); + $this->assertNotEmpty($siteId); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertArrayHasKey('adapter', $site['body']); + $this->assertEmpty($site['body']['adapter']); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('astro'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId); + + $site = $this->getSite($siteId); + $this->assertEquals('ssr', $site['body']['adapter']); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + + $this->cleanupSite($siteId); + } + + public function testAdapterDetectionAstroStatic(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Astro static site', + 'framework' => 'astro', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + ]); + $this->assertNotEmpty($siteId); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertArrayHasKey('adapter', $site['body']); + $this->assertEmpty($site['body']['adapter']); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('astro-static'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEquals('static', $site['body']['adapter']); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + + $this->cleanupSite($siteId); + } + + public function testAdapterDetectionStatic(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Static site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'outputDirectory' => '', + 'buildCommand' => '', + 'installCommand' => '', + ]); + $this->assertNotEmpty($siteId); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertArrayHasKey('adapter', $site['body']); + $this->assertEmpty($site['body']['adapter']); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEquals('static', $site['body']['adapter']); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + + $this->cleanupSite($siteId); + } + + public function testAdapterDetectionStaticSPA(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Static site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'outputDirectory' => '', + 'buildCommand' => '', + 'installCommand' => '', + ]); + $this->assertNotEmpty($siteId); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertArrayHasKey('adapter', $site['body']); + $this->assertArrayHasKey('fallbackFile', $site['body']); + $this->assertEmpty($site['body']['adapter']); + $this->assertEmpty($site['body']['fallbackFile']); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static-single-file'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEquals('static', $site['body']['adapter']); + $this->assertEquals('main.html', $site['body']['fallbackFile']); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('Main page', $response['body']); + $response = $proxyClient->call(Client::METHOD_GET, '/something'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('Main page', $response['body']); + + $this->cleanupSite($siteId); + } + + public function testSettingsForRollback(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Static site', + 'framework' => 'astro', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + ]); + $this->assertNotEmpty($siteId); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEmpty($site['body']['adapter']); + $this->assertEmpty($site['body']['fallbackFile']); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + + $deploymentId1 = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('astro-static'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId1); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEquals('static', $site['body']['adapter']); + $this->assertEquals('index.html', $site['body']['fallbackFile']); + + $site = $this->updateSite([ + 'name' => 'SSR site', + 'framework' => 'astro', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'adapter' => 'ssr', + 'fallbackFile' => '', + '$id' => $siteId, + ]); + + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEquals('ssr', $site['body']['adapter']); + $this->assertEmpty($site['body']['fallbackFile']); + + $deploymentId2 = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('astro'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId2); + + $site = $this->getSite($siteId); + $this->assertEquals('200', $site['headers']['status-code']); + $this->assertEquals('ssr', $site['body']['adapter']); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Astro SSR", $response['body']); + $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); + $this->assertEquals(404, $response['headers']['status-code']); + + $response = $this->updateSiteDeployment($siteId, $deploymentId1); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Astro static", $response['body']); + $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Astro static", $response['body']); + + $this->cleanupSite($siteId); + } + + public function testListSites(): void + { + /** + * Test for SUCCESS + */ + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $sites = $this->listSites(); + + $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertCount(1, $sites['body']['sites']); + $this->assertEquals($sites['body']['sites'][0]['name'], 'Test Site'); + + // Test pagination limit + $sites = $this->listSites([ + 'queries' => [ + Query::limit(1)->toString(), + ], + ]); + + $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertCount(1, $sites['body']['sites']); + + // Test pagination offset + $sites = $this->listSites([ + 'queries' => [ + Query::offset(1)->toString(), + ], + ]); + + $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertCount(0, $sites['body']['sites']); + + // Test filter enabled + $sites = $this->listSites([ + 'queries' => [ + Query::equal('enabled', [true])->toString(), + ], + ]); + + $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertCount(1, $sites['body']['sites']); + + // Test filter disabled + $sites = $this->listSites([ + 'queries' => [ + Query::equal('enabled', [false])->toString(), + ], + ]); + + $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertCount(0, $sites['body']['sites']); + + // Test search name + $sites = $this->listSites([ + 'search' => 'Test' + ]); + + $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertCount(1, $sites['body']['sites']); + $this->assertEquals($sites['body']['sites'][0]['$id'], $siteId); + + // Test search framework + $sites = $this->listSites([ + 'search' => 'other' + ]); + + $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertCount(1, $sites['body']['sites']); + $this->assertEquals($sites['body']['sites'][0]['$id'], $siteId); + + /** + * Test pagination + */ + $siteId2 = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site 2', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $sites = $this->listSites(); + + $this->assertEquals($sites['headers']['status-code'], 200); + $this->assertEquals($sites['body']['total'], 2); + $this->assertIsArray($sites['body']['sites']); + $this->assertCount(2, $sites['body']['sites']); + $this->assertEquals($sites['body']['sites'][0]['name'], 'Test Site'); + $this->assertEquals($sites['body']['sites'][1]['name'], 'Test Site 2'); + + $sites1 = $this->listSites([ + 'queries' => [ + Query::cursorAfter(new Document(['$id' => $sites['body']['sites'][0]['$id']]))->toString(), + ], + ]); + + $this->assertEquals($sites1['headers']['status-code'], 200); + $this->assertCount(1, $sites1['body']['sites']); + $this->assertEquals($sites1['body']['sites'][0]['name'], 'Test Site 2'); + + $sites2 = $this->listSites([ + 'queries' => [ + Query::cursorBefore(new Document(['$id' => $sites['body']['sites'][1]['$id']]))->toString(), + ], + ]); + + $this->assertEquals($sites2['headers']['status-code'], 200); + $this->assertCount(1, $sites2['body']['sites']); + $this->assertEquals($sites2['body']['sites'][0]['name'], 'Test Site'); + + /** + * Test for FAILURE + */ + $sites = $this->listSites([ + 'queries' => [ + Query::cursorAfter(new Document(['$id' => 'unknown']))->toString(), + ], + ]); + $this->assertEquals($sites['headers']['status-code'], 400); + + $this->cleanupSite($siteId); + $this->cleanupSite($siteId2); + } + + public function testGetSite(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + /** + * Test for SUCCESS + */ + $site = $this->getSite($siteId); + + $this->assertEquals($site['headers']['status-code'], 200); + $this->assertEquals($site['body']['name'], 'Test Site'); + + /** + * Test for FAILURE + */ + $site = $this->getSite('x'); + + $this->assertEquals($site['headers']['status-code'], 404); + + $this->cleanupSite($siteId); + } + + public function testUpdateSite(): void + { + $site = $this->createSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $siteId = $site['body']['$id'] ?? ''; + + $this->assertEquals(201, $site['headers']['status-code']); + $this->assertNotEmpty($site['body']['$id']); + $this->assertEquals('Test Site', $site['body']['name']); + + $site = $this->updateSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site Updated', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + '$id' => $siteId, + 'installCommand' => 'npm install' + ]); + + $dateValidator = new DatetimeValidator(); + + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertNotEmpty($site['body']['$id']); + $this->assertEquals('Test Site Updated', $site['body']['name']); + $this->assertEquals(true, $dateValidator->isValid($site['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($site['body']['$updatedAt'])); + $this->assertEquals('npm install', $site['body']['installCommand']); + + $this->cleanupSite($siteId); + } + + // public function testCreateDeploymentFromCLI() { + // // TODO: Implement testCreateDeploymentFromCLI() later + // } + + public function testCreateDeployment() + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + $deployment = $this->createDeployment($siteId, [ + 'siteId' => $siteId, + 'code' => $this->packageSite('static'), + 'activate' => true, + ]); + + $this->assertEquals(202, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['$id']); + $this->assertEquals('waiting', $deployment['body']['status']); + $this->assertEquals(true, (new DatetimeValidator())->isValid($deployment['body']['$createdAt'])); + + $deploymentIdActive = $deployment['body']['$id'] ?? ''; + + $this->assertEventually(function () use ($siteId, $deploymentIdActive) { + $deployment = $this->getDeployment($siteId, $deploymentIdActive); + + $this->assertEquals('ready', $deployment['body']['status']); + }, 50000, 500); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'false' + ]); + + $this->assertEquals(202, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['$id']); + + $deploymentIdInactive = $deployment['body']['$id'] ?? ''; + + $this->assertEventually(function () use ($siteId, $deploymentIdInactive) { + $deployment = $this->getDeployment($siteId, $deploymentIdInactive); + + $this->assertEquals('ready', $deployment['body']['status']); + }, 50000, 500); + + $site = $this->getSite($siteId); + + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deploymentIdActive, $site['body']['deploymentId']); + $this->assertNotEquals($deploymentIdInactive, $site['body']['deploymentId']); + + $this->cleanupDeployment($siteId, $deploymentIdActive); + $this->cleanupDeployment($siteId, $deploymentIdInactive); + $this->cleanupSite($siteId); + } + + #[Retry(count: 3)] + public function testCancelDeploymentBuild(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'false' + ]); + + $deploymentId = $deployment['body']['$id'] ?? ''; + $this->assertEquals(202, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['$id']); + $this->assertEquals(true, (new DatetimeValidator())->isValid($deployment['body']['$createdAt'])); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertEquals('building', $deployment['body']['status']); + }, 100000, 250); + + $deployment = $this->cancelDeployment($siteId, $deploymentId); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertEquals('canceled', $deployment['body']['status']); + + /** + * Build worker still runs the build. + * 30s sleep gives worker enough time to finish build. + * After build finished, it should still be canceled, not ready. + */ + \sleep(30); + + $deployment = $this->getDeployment($siteId, $deploymentId); + + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertEquals('canceled', $deployment['body']['status']); + + $this->cleanupDeployment($siteId, $deploymentId); + $this->cleanupSite($siteId); + } + + public function testUpdateDeployment(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'false' + ]); + + $deploymentId = $deployment['body']['$id'] ?? ''; + $this->assertEquals(202, $deployment['headers']['status-code']); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + + $this->assertEquals('ready', $deployment['body']['status']); + }, 50000, 500); + + /** + * Test for SUCCESS + */ + $dateValidator = new DatetimeValidator(); + + $response = $this->updateSiteDeployment($siteId, $deploymentId); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertNotEmpty($response['body']['$id']); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$createdAt'])); + $this->assertEquals(true, $dateValidator->isValid($response['body']['$updatedAt'])); + $this->assertEquals($deploymentId, $response['body']['deploymentId']); + + $this->cleanupDeployment($siteId, $deploymentId); + $this->cleanupSite($siteId); + } + + public function testListDeployments(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'false' + ]); + + $deploymentIdActive = $deployment['body']['$id'] ?? ''; + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'false' + ]); + + $this->assertEquals(202, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['$id']); + + $deploymentIdInactive = $deployment['body']['$id'] ?? ''; + + $deployments = $this->listDeployments($siteId); + + $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals($deployments['body']['total'], 2); + $this->assertIsArray($deployments['body']['deployments']); + $this->assertCount(2, $deployments['body']['deployments']); + $this->assertArrayHasKey('sourceSize', $deployments['body']['deployments'][0]); + $this->assertArrayHasKey('buildSize', $deployments['body']['deployments'][0]); + + $deployments = $this->listDeployments($siteId, [ + 'queries' => [ + Query::limit(1)->toString(), + ], + ]); + + $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertCount(1, $deployments['body']['deployments']); + + $deployments = $this->listDeployments($siteId, [ + 'queries' => [ + Query::offset(1)->toString(), + ], + ]); + + $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertCount(1, $deployments['body']['deployments']); + + $deployments = $this->listDeployments( + $siteId, + [ + 'queries' => [ + Query::equal('type', ['manual'])->toString(), + ], + ] + ); + + $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(2, $deployments['body']['total']); + + $deployments = $this->listDeployments( + $siteId, + [ + 'queries' => [ + Query::equal('type', ['vcs'])->toString(), + ], + ] + ); + + $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(0, $deployments['body']['total']); + + $deployments = $this->listDeployments( + $siteId, + [ + 'queries' => [ + Query::equal('type', ['invalid-string'])->toString(), + ], + ] + ); + + $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(0, $deployments['body']['total']); + + $deployments = $this->listDeployments( + $siteId, + [ + 'queries' => [ + Query::greaterThan('sourceSize', 10000)->toString(), + ], + ] + ); + + $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(0, $deployments['body']['total']); + + $deployments = $this->listDeployments( + $siteId, + [ + 'queries' => [ + Query::greaterThan('sourceSize', 0)->toString(), + ], + ] + ); + + $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(2, $deployments['body']['total']); + + $deployments = $this->listDeployments( + $siteId, + [ + 'queries' => [ + Query::greaterThan('sourceSize', -100)->toString(), + ], + ] + ); + $this->assertEquals($deployments['headers']['status-code'], 200); + $this->assertEquals(2, $deployments['body']['total']); + + /** + * Ensure size output and size filters work exactly. + * Prevents buildSize being counted towards deployment size + */ + $deployments = $this->listDeployments( + $siteId, + [ + Query::limit(1)->toString(), + ] + ); + + $this->assertEquals(200, $deployments['headers']['status-code']); + $this->assertGreaterThanOrEqual(1, $deployments['body']['total']); + $this->assertNotEmpty($deployments['body']['deployments'][0]['$id']); + $this->assertNotEmpty($deployments['body']['deployments'][0]['sourceSize']); + + $deploymentId = $deployments['body']['deployments'][0]['$id']; + $deploymentSize = $deployments['body']['deployments'][0]['sourceSize']; + + $deployments = $this->listDeployments( + $siteId, + [ + 'queries' => [ + Query::equal('sourceSize', [$deploymentSize])->toString(), + ], + ] + ); + + $this->assertEquals(200, $deployments['headers']['status-code']); + $this->assertGreaterThan(0, $deployments['body']['total']); + + $matchingDeployment = array_filter( + $deployments['body']['deployments'], + fn ($deployment) => $deployment['$id'] === $deploymentId + ); + + $this->assertNotEmpty($matchingDeployment, "Deployment with ID {$deploymentId} not found"); + + if (!empty($matchingDeployment)) { + $deployment = reset($matchingDeployment); + $this->assertEquals($deploymentSize, $deployment['sourceSize']); + } + + $this->cleanupDeployment($siteId, $deploymentIdActive); + $this->cleanupDeployment($siteId, $deploymentIdInactive); + $this->cleanupSite($siteId); + } + + public function testGetDeployment(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'false' + ]); + + $deploymentId = $deployment['body']['$id'] ?? ''; + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + + $this->assertEquals('ready', $deployment['body']['status']); + }, 50000, 500); + + /** + * Test for SUCCESS + */ + $deployment = $this->getDeployment($siteId, $deploymentId); + + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['buildDuration']); + $this->assertNotEmpty($deployment['body']['status']); + $this->assertNotEmpty($deployment['body']['buildLogs']); + $this->assertArrayHasKey('sourceSize', $deployment['body']); + $this->assertArrayHasKey('buildSize', $deployment['body']); + + /** + * Test for FAILURE + */ + $deployment = $this->getDeployment($siteId, 'x'); + + $this->assertEquals($deployment['headers']['status-code'], 404); + + $this->cleanupDeployment($siteId, $deploymentId); + $this->cleanupSite($siteId); + } + + public function testUpdateSpecs(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + /** + * Test for SUCCESS + */ + // Change the function specs + $site = $this->updateSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + '$id' => $siteId, + 'specification' => Specification::S_1VCPU_1GB, + ]); + + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertNotEmpty($site['body']['$id']); + $this->assertEquals(Specification::S_1VCPU_1GB, $site['body']['specification']); + + // Change the specs to 1vcpu 512mb + $site = $this->updateSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + '$id' => $siteId, + 'specification' => Specification::S_1VCPU_512MB, + ]); + + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertNotEmpty($site['body']['$id']); + $this->assertEquals(Specification::S_1VCPU_512MB, $site['body']['specification']); + + /** + * Test for FAILURE + */ + + $site = $this->updateSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + '$id' => $siteId, + 'specification' => 's-2vcpu-512mb', // Invalid specification + ]); + + $this->assertEquals(400, $site['headers']['status-code']); + $this->assertStringStartsWith('Invalid `specification` param: Specification must be one of:', $site['body']['message']); + + $this->cleanupSite($siteId); + } + + public function testDeleteDeployment(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'false' + ]); + + $deploymentId = $deployment['body']['$id'] ?? ''; + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + + $this->assertEquals('ready', $deployment['body']['status']); + }, 50000, 500); + + /** + * Test for SUCCESS + */ + $deployment = $this->client->call(Client::METHOD_DELETE, '/sites/' . $siteId . '/deployments/' . $deploymentId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(204, $deployment['headers']['status-code']); + $this->assertEmpty($deployment['body']); + + $deployment = $this->getDeployment($siteId, $deploymentId); + + $this->assertEquals(404, $deployment['headers']['status-code']); + } + + public function testDeleteSite(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $this->assertNotNull($siteId); + + $site = $this->deleteSite($siteId); + + $this->assertEquals(204, $site['headers']['status-code']); + $this->assertEmpty($site['body']); + + $function = $this->getSite($siteId); + + $this->assertEquals(404, $function['headers']['status-code']); + } + + public function testGetFrameworks(): void + { + $frameworks = $this->client->call(Client::METHOD_GET, '/sites/frameworks', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ])); + + $this->assertEquals(200, $frameworks['headers']['status-code']); + $this->assertGreaterThan(0, $frameworks['body']['total']); + + $framework = $frameworks['body']['frameworks'][0]; + + $this->assertArrayHasKey('name', $framework); + $this->assertArrayHasKey('key', $framework); + $this->assertArrayHasKey('buildRuntime', $framework); + $this->assertArrayHasKey('runtimes', $framework); + $this->assertArrayHasKey('adapters', $framework); + $this->assertIsArray($framework['adapters']); + $this->assertArrayHasKey('key', $framework['adapters'][0]); + $this->assertArrayHasKey('installCommand', $framework['adapters'][0]); + $this->assertArrayHasKey('buildCommand', $framework['adapters'][0]); + $this->assertArrayHasKey('outputDirectory', $framework['adapters'][0]); + } + + public function testSiteStatic(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Non-SPA site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => '', + 'installCommand' => '', + 'fallbackFile' => '', + ]); + + $this->assertNotEmpty($siteId); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static-spa'), + 'activate' => 'true' + ]); + + $this->assertNotEmpty($deploymentId); + + $domain = $this->setupSiteDomain($siteId); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ])); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Index page", $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ])); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Contact page", $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/non-existing', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ])); + + $this->assertEquals(404, $response['headers']['status-code']); + $this->assertStringContainsString("Page not found", $response['body']); // Title + $this->assertStringContainsString("Go to homepage", $response['body']); // Button + $this->assertStringContainsString("Powered by", $response['body']); // Brand + + $this->cleanupSite($siteId); + } + + public function testSiteStaticSPA(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'SPA site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => '', + 'installCommand' => '', + 'fallbackFile' => '404.html', + ]); + + $this->assertNotEmpty($siteId); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static-spa'), + 'activate' => 'true' + ]); + + $this->assertNotEmpty($deploymentId); + + $domain = $this->setupSiteDomain($siteId); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ])); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Index page", $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ])); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Contact page", $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/non-existing', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ])); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Customized 404 page", $response['body']); + $this->assertStringNotContainsString("Powered by", $response['body']); // Brand + + $this->cleanupSite($siteId); + } + + public function testSiteTemplate(): void + { + $template = $this->getTemplate('playground-for-astro'); + $this->assertEquals(200, $template['headers']['status-code']); + + $template = $template['body']; + + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Template site', + 'framework' => $template['frameworks'][0]['key'], + 'adapter' => $template['frameworks'][0]['adapter'], + 'buildRuntime' => $template['frameworks'][0]['buildRuntime'], + 'outputDirectory' => $template['frameworks'][0]['outputDirectory'], + 'buildCommand' => $template['frameworks'][0]['buildCommand'], + 'installCommand' => $template['frameworks'][0]['installCommand'], + 'fallbackFile' => $template['frameworks'][0]['fallbackFile'], + ]); + + $this->assertNotEmpty($siteId); + + $deployment = $this->createTemplateDeployment($siteId, [ + 'repository' => $template['providerRepositoryId'], + 'owner' => $template['providerOwner'], + 'rootDirectory' => $template['frameworks'][0]['providerRootDirectory'], + 'version' => $template['providerVersion'], + 'activate' => true + ]); + + $this->assertEquals(202, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['$id']); + + $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertEquals(0, $deployment['body']['sourceSize']); + $this->assertEquals(0, $deployment['body']['buildSize']); + $this->assertEquals(0, $deployment['body']['totalSize']); + + $this->assertEventually(function () use ($siteId) { + $site = $this->getSite($siteId); + $this->assertNotEmpty($site['body']['deploymentId']); + }, 50000, 500); + + $domain = $this->setupSiteDomain($siteId); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Astro Blog", $response['body']); + $this->assertStringContainsString("Hello, Astronaut!", $response['body']); + + $response = $proxyClient->call(Client::METHOD_GET, '/about'); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Astro Blog", $response['body']); + $this->assertStringContainsString("About Me", $response['body']); + + $deployment = $this->getDeployment($siteId, $deployment['body']['$id']); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['sourceSize']); + $this->assertGreaterThan(0, $deployment['body']['buildSize']); + $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; + $this->assertEquals($totalSize, $deployment['body']['totalSize']); + + $this->cleanupSite($siteId); + } + + public function testSiteDomainReclaiming(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Startup site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => '', + 'installCommand' => '', + 'fallbackFile' => '', + ]); + + $this->assertNotEmpty($siteId); + + $subdomain = 'startup' . \uniqid(); + $domain = $this->setupSiteDomain($siteId, $subdomain); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'true' + ]); + + $this->assertNotEmpty($deploymentId); + + $domain = $this->getSiteDomain($siteId); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringNotContainsString("This domain is not connected to any Appwrite resource yet", $response['body']); + + $site2 = $this->createSite([ + 'siteId' => ID::unique(), + 'name' => 'Startup 2 site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => '', + 'installCommand' => '', + 'fallbackFile' => '', + ]); + + $siteId2 = $site2['body']['$id']; + + $rule = $this->client->call(Client::METHOD_POST, '/proxy/rules/site', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'domain' => $subdomain . '.' . System::getEnv('_APP_DOMAIN_SITES', ''), + 'siteId' => $siteId2, + ]); + + $this->assertEquals(409, $rule['headers']['status-code']); + + $this->cleanupSite($siteId); + + $this->assertEventually(function () use ($domain) { + $rules = $this->client->call(Client::METHOD_GET, '/proxy/rules', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('domain', [$domain])->toString(), + ], + ]); + + $this->assertEquals(200, $rules['headers']['status-code']); + $this->assertEquals(0, $rules['body']['total']); + }, 50000, 500); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + + $this->assertEquals(404, $response['headers']['status-code']); + $this->assertStringContainsString("This page is empty, but you can make it yours.", $response['body']); + + $site = $this->createSite([ + 'siteId' => ID::unique(), + 'name' => 'Startup 2 site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => '', + 'installCommand' => '', + 'fallbackFile' => '', + ]); + + $this->assertEquals(201, $site['headers']['status-code']); + $this->assertNotEmpty($site['body']['$id']); + + $siteId = $site['body']['$id']; + + $domain = $this->setupSiteDomain($siteId, $subdomain); + + $this->assertNotEmpty($domain); + + $this->cleanupSite($site['body']['$id']); + } + + public function testSitePreviewBranding(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'A site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => '', + 'installCommand' => '', + 'fallbackFile' => '', + ]); + + $this->assertNotEmpty($siteId); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId); + + $siteDomain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($siteDomain); + + $deploymentDomain = $this->getDeploymentDomain($deploymentId); + $this->assertNotEmpty($deploymentDomain); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $siteDomain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Hello Appwrite", $response['body']); + $this->assertStringNotContainsString("Preview by", $response['body']); + $contentLength = $response['headers']['content-length']; + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $deploymentDomain); + $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); + + $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 0); + $apiKey = $jwtObj->encode([ + 'projectCheckDisabled' => true, + 'previewAuthDisabled' => true, + ]); + $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false, headers: [ + 'x-appwrite-key' => API_KEY_DYNAMIC . '_' . $apiKey, + ]); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Hello Appwrite", $response['body']); + $this->assertStringContainsString("Preview by", $response['body']); + $this->assertGreaterThan($contentLength, $response['headers']['content-length']); + + $response = $proxyClient->call(Client::METHOD_GET, '/non-existing-path', followRedirects: false, headers: [ + 'x-appwrite-key' => API_KEY_DYNAMIC . '_' . $apiKey, + ]); + $this->assertEquals(404, $response['headers']['status-code']); + $this->assertStringContainsString("Page not found", $response['body']); + $this->assertStringNotContainsString("Preview by", $response['body']); + $this->assertGreaterThan($contentLength, $response['headers']['content-length']); + + $this->cleanupSite($siteId); + } + + public function testSiteCors(): void + { + // Create rule together with site + $subdomain = 'startup' . \uniqid(); + + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Startup site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => '', + 'installCommand' => '', + 'fallbackFile' => '', + 'subdomain' => $subdomain + ]); + + $this->assertNotEmpty($siteId); + + $this->setupSiteDomain($siteId, $subdomain); + $domain = $this->getSiteDomain($siteId); + + $this->assertNotEmpty($domain); + + $url = 'http://' . $domain; + + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'referer' => $url, + 'origin' => $url + ])); + + $this->assertEquals($url, $response['headers']['access-control-allow-origin']); + + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => 'unknown', + 'referer' => $url, + 'origin' => $url + ])); + + $this->assertNotEquals($url, $response['headers']['access-control-allow-origin']); + $this->assertEquals('http://localhost', $response['headers']['access-control-allow-origin']); + + $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'referer' => 'http://unknown.com', + 'origin' => 'http://unknown.com' + ])); + + $this->assertNotEquals($url, $response['headers']['access-control-allow-origin']); + $this->assertEquals('http://localhost', $response['headers']['access-control-allow-origin']); + } + + public function testSiteDownload(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'fallbackFile' => '', + 'framework' => 'other', + 'name' => 'Test Site', + 'adapter' => 'static', + 'outputDirectory' => './', + 'providerBranch' => 'main', + 'providerRootDirectory' => './', + 'siteId' => ID::unique() + ]); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => true + ]); + + $this->assertNotEmpty($deploymentId); + + $response = $this->getDeploymentDownload($siteId, $deploymentId, 'source'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('application/gzip', $response['headers']['content-type']); + $this->assertGreaterThan(0, $response['headers']['content-length']); + $this->assertGreaterThan(0, \strlen($response['body'])); + + $deploymentMd5 = \md5($response['body']); + + $response = $this->getDeploymentDownload($siteId, $deploymentId, 'output'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('application/gzip', $response['headers']['content-type']); + $this->assertGreaterThan(0, $response['headers']['content-length']); + $this->assertGreaterThan(0, \strlen($response['body'])); + + $buildMd5 = \md5($response['body']); + + $this->assertNotEquals($deploymentMd5, $buildMd5); + + $this->cleanupSite($siteId); + } + + public function testSSRLogs(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'SSR site', + 'framework' => 'astro', + 'adapter' => 'ssr', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'fallbackFile' => '', + ]); + + $this->assertNotEmpty($siteId); + + $domain = $this->setupSiteDomain($siteId); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('astro'), + 'activate' => 'true' + ]); + + $this->assertNotEmpty($deploymentId); + + $domain = $this->getSiteDomain($siteId); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/logs-inline'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Inline logs printed.", $response['body']); + + $logs = $this->listLogs($siteId, [ + Query::orderDesc('$createdAt')->toString(), + Query::limit(1)->toString(), + ]); + $this->assertEquals(200, $logs['headers']['status-code']); + $this->assertStringContainsString("GET", $logs['body']['executions'][0]['requestMethod']); + $this->assertStringContainsString("/logs-inline", $logs['body']['executions'][0]['requestPath']); + $this->assertStringContainsString("Log1", $logs['body']['executions'][0]['logs']); + $this->assertStringContainsString("Log2", $logs['body']['executions'][0]['logs']); + $this->assertStringContainsString("Error1", $logs['body']['executions'][0]['errors']); + $this->assertStringContainsString("Error2", $logs['body']['executions'][0]['errors']); + $log1Id = $logs['body']['executions'][0]['$id']; + $this->assertNotEmpty($log1Id); + + $response = $proxyClient->call(Client::METHOD_GET, '/logs-action'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Action logs printed.", $response['body']); + + $logs = $this->listLogs($siteId, [ + Query::orderDesc('$createdAt')->toString(), + Query::limit(1)->toString(), + ]); + $this->assertEquals(200, $logs['headers']['status-code']); + $this->assertStringContainsString("GET", $logs['body']['executions'][0]['requestMethod']); + $this->assertStringContainsString("/logs-action", $logs['body']['executions'][0]['requestPath']); + $this->assertStringContainsString("Log1", $logs['body']['executions'][0]['logs']); + $this->assertStringContainsString("Log2", $logs['body']['executions'][0]['logs']); + $this->assertStringContainsString("Error1", $logs['body']['executions'][0]['errors']); + $this->assertStringContainsString("Error2", $logs['body']['executions'][0]['errors']); + $log2Id = $logs['body']['executions'][0]['$id']; + $this->assertNotEmpty($log2Id); + + $this->assertNotEquals($log1Id, $log2Id); + + $site = $this->updateSite( + [ + '$id' => $siteId, + 'name' => 'SSR site', + 'framework' => 'astro', + 'adapter' => 'ssr', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + 'fallbackFile' => '', + 'logging' => false // set logging to false + ] + ); + $this->assertEquals(200, $site['headers']['status-code']); + $response = $proxyClient->call(Client::METHOD_GET, '/logs-inline'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Inline logs printed.", $response['body']); + + $logs = $this->listLogs($siteId, [ + Query::orderDesc('$createdAt')->toString(), + Query::limit(1)->toString(), + ]); + $this->assertEquals(200, $logs['headers']['status-code']); + $this->assertEquals("GET", $logs['body']['executions'][0]['requestMethod']); + $this->assertEquals("/logs-inline", $logs['body']['executions'][0]['requestPath']); + $this->assertEmpty($logs['body']['executions'][0]['logs']); + $this->assertEmpty($logs['body']['executions'][0]['logs']); + $this->assertEmpty($logs['body']['executions'][0]['errors']); + $this->assertEmpty($logs['body']['executions'][0]['errors']); + $log1Id = $logs['body']['executions'][0]['$id']; + $this->assertNotEmpty($log1Id); + + $response = $proxyClient->call(Client::METHOD_GET, '/logs-action'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Action logs printed.", $response['body']); + + $logs = $this->listLogs($siteId, [ + Query::orderDesc('$createdAt')->toString(), + Query::limit(1)->toString(), + ]); + $this->assertEquals(200, $logs['headers']['status-code']); + $this->assertEquals("GET", $logs['body']['executions'][0]['requestMethod']); + $this->assertEquals("/logs-action", $logs['body']['executions'][0]['requestPath']); + $this->assertEmpty($logs['body']['executions'][0]['logs']); + $this->assertEmpty($logs['body']['executions'][0]['logs']); + $this->assertEmpty($logs['body']['executions'][0]['errors']); + $this->assertEmpty($logs['body']['executions'][0]['errors']); + $log2Id = $logs['body']['executions'][0]['$id']; + $this->assertNotEmpty($log2Id); + + $this->cleanupSite($siteId); + } + + public function testDuplicateDeployment(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'framework' => 'other', + 'name' => 'Duplicate deployment Site', + 'adapter' => 'static', + 'fallbackFile' => '404.html', + 'siteId' => ID::unique() + ]); + $this->assertNotEmpty($siteId); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $deploymentId1 = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static-spa'), + 'activate' => true + ]); + $this->assertNotEmpty($deploymentId1); + + $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); + $this->assertStringContainsString("Customized 404 page", $response['body']); + + $site = $this->updateSite([ + '$id' => $siteId, + 'buildRuntime' => 'node-22', + 'framework' => 'other', + 'name' => 'Duplicate deployment Site', + 'adapter' => 'static', + 'fallbackFile' => 'index.html', + ]); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals('index.html', $site['body']['fallbackFile']); + + $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments/duplicate', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-sdk-language' => 'cli' + ], $this->getHeaders()), [ + 'deploymentId' => $deploymentId1, + ]); + + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId2 = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId2); + + $deployment = $this->getDeployment($siteId, $deploymentId2); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['sourceSize']); + $this->assertEquals(0, $deployment['body']['buildSize']); + $this->assertEquals($deployment['body']['sourceSize'], $deployment['body']['totalSize']); + $this->assertEquals('cli', $deployment['body']['type']); + + // create another duplicate deployment with manual trigger + $deployment = $this->client->call(Client::METHOD_POST, '/sites/' . $siteId . '/deployments/duplicate', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'deploymentId' => $deploymentId1, + ]); + + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId2 = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId2); + + $deployment = $this->getDeployment($siteId, $deploymentId2); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['sourceSize']); + $this->assertEquals(0, $deployment['body']['buildSize']); + $this->assertEquals($deployment['body']['sourceSize'], $deployment['body']['totalSize']); + $this->assertEquals('manual', $deployment['body']['type']); + + $this->assertEventually(function () use ($siteId, $deploymentId2) { + $site = $this->getSite($siteId); + $this->assertEquals($deploymentId2, $site['body']['deploymentId']); + }, 50000, 500); + + $response = $proxyClient->call(Client::METHOD_GET, '/not-found'); + $this->assertStringContainsString("Index page", $response['body']); + + $deployment = $this->getDeployment($siteId, $deploymentId2); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertGreaterThan(0, $deployment['body']['sourceSize']); + $this->assertGreaterThan(0, $deployment['body']['buildSize']); + $totalSize = $deployment['body']['sourceSize'] + $deployment['body']['buildSize']; + $this->assertEquals($totalSize, $deployment['body']['totalSize']); + + $this->cleanupSite($siteId); + } + + public function testUpdateDeploymentStatus(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'framework' => 'other', + 'name' => 'Activate test Site', + 'siteId' => ID::unique(), + 'adapter' => 'static', + ]); + $this->assertNotEmpty($siteId); + + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertArrayHasKey('latestDeploymentId', $site['body']); + $this->assertArrayHasKey('latestDeploymentCreatedAt', $site['body']); + $this->assertArrayHasKey('latestDeploymentStatus', $site['body']); + $this->assertEmpty($site['body']['latestDeploymentId']); + $this->assertEmpty($site['body']['latestDeploymentCreatedAt']); + $this->assertEmpty($site['body']['latestDeploymentStatus']); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $deploymentId1 = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => true + ]); + $this->assertNotEmpty($deploymentId1); + + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deploymentId1, $site['body']['latestDeploymentId']); + $this->assertEquals('ready', $site['body']['latestDeploymentStatus']); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('Hello Appwrite', $response['body']); + + $deploymentId2 = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static-spa'), + 'activate' => true + ]); + $this->assertNotEmpty($deploymentId2); + + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deploymentId2, $site['body']['latestDeploymentId']); + $this->assertEquals('ready', $site['body']['latestDeploymentStatus']); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('Index page', $response['body']); + + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deploymentId2, $site['body']['deploymentId']); + $this->assertEquals($deploymentId2, $site['body']['latestDeploymentId']); + $this->assertEquals('ready', $site['body']['latestDeploymentStatus']); + + $site = $this->updateSiteDeployment($siteId, $deploymentId1); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deploymentId1, $site['body']['deploymentId']); + + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deploymentId1, $site['body']['deploymentId']); + $this->assertEquals($deploymentId2, $site['body']['latestDeploymentId']); + $this->assertEquals('ready', $site['body']['latestDeploymentStatus']); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('Hello Appwrite', $response['body']); + + $deployment = $this->deleteDeployment($siteId, $deploymentId2); + $this->assertEquals(204, $deployment['headers']['status-code']); + + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertEquals($deploymentId1, $site['body']['latestDeploymentId']); + $this->assertEquals('ready', $site['body']['latestDeploymentStatus']); + + $this->cleanupSite($siteId); + } + + public function testPreviewDomain(): void + { + $siteId = $this->setupSite([ + 'buildRuntime' => 'node-22', + 'framework' => 'other', + 'name' => 'Authorized preview site', + 'siteId' => ID::unique(), + 'adapter' => 'static', + ]); + $this->assertNotEmpty($siteId); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => true + ]); + $this->assertNotEmpty($deploymentId); + + $domain = $this->getDeploymentDomain($deploymentId); + $this->assertNotEmpty($domain); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact', followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); + $this->assertStringContainsString('projectId=' . $this->getProject()['$id'], $response['headers']['location']); + $this->assertStringContainsString('origin=', $response['headers']['location']); + $this->assertStringContainsString('path=%2Fcontact', $response['headers']['location']); + + $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + ]), [ + 'email' => $this->getRoot()['email'], + 'password' => 'password' + ]); + $this->assertEquals(201, $session['headers']['status-code']); + $this->assertNotEmpty($session['cookies']['a_session_console']); + $this->assertNotEmpty($session['body']['$id']); + $cookie = 'a_session_console=' . $session['cookies']['a_session_console']; + + $jwt = $this->client->call(Client::METHOD_POST, '/account/jwts', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => $cookie, + 'x-appwrite-project' => 'console', + ]), []); + $this->assertEquals(201, $jwt['headers']['status-code']); + $this->assertNotEmpty($jwt['body']['jwt']); + + $response = $proxyClient->call(Client::METHOD_GET, '/_appwrite/authorize', params: [ + 'jwt' => $jwt['body']['jwt'], + 'path' => '/contact' + ], followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + $this->assertArrayHasKey('set-cookie', $response['headers']); + $this->assertStringContainsString('a_jwt_console=', $response['headers']['set-cookie']); + $this->assertStringContainsString('httponly', $response['headers']['set-cookie']); + $this->assertStringContainsString('domain=' . $domain, $response['headers']['set-cookie']); + $this->assertStringContainsString('path=/', $response['headers']['set-cookie']); + $this->assertNotEmpty($response['cookies']['a_jwt_console']); + $this->assertEquals($jwt['body']['jwt'], $response['cookies']['a_jwt_console']); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ + 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] + ], followRedirects: false); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Contact page", $response['body']); + $this->assertStringContainsString("Preview by", $response['body']); + + // Failure: Session missing (old bad, new ok) + $session = $this->client->call(Client::METHOD_DELETE, '/account/sessions/current', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => $cookie, + 'x-appwrite-project' => 'console', + ]), []); + $this->assertEquals(204, $session['headers']['status-code']); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ + 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] + ], followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); + + // Failure: User missing + $cookie = 'a_session_console=' .$this->getRoot()['session']; + $jwt = $this->client->call(Client::METHOD_POST, '/account/jwts', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => $cookie, + 'x-appwrite-project' => 'console', + ]), []); + $this->assertEquals(201, $jwt['headers']['status-code']); + $this->assertNotEmpty($jwt['body']['jwt']); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ + 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] + ], followRedirects: false); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString("Contact page", $response['body']); + $this->assertStringContainsString("Preview by", $response['body']); + + $user = $this->client->call(Client::METHOD_PATCH, '/account/status', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => $cookie, + 'x-appwrite-project' => 'console', + ]), []); + $this->assertEquals(200, $user['headers']['status-code']); + $this->assertFalse($user['body']['status']); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ + 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] + ], followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); + + // Failure: Membership missing + $email = \uniqid() . 'newuser@appwrite.io'; + $user = $this->client->call(Client::METHOD_POST, '/account', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + ], [ + 'userId' => ID::unique(), + 'email' => $email, + 'password' => 'password' + ]); + $this->assertEquals(201, $user['headers']['status-code']); + + $session = $this->client->call(Client::METHOD_POST, '/account/sessions/email', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => 'console', + ], [ + 'email' => $email, + 'password' => 'password', + ]); + $this->assertEquals(201, $session['headers']['status-code']); + $this->assertNotEmpty($session['cookies']['a_session_console']); + $cookie = 'a_session_console=' . $session['cookies']['a_session_console']; + + $jwt = $this->client->call(Client::METHOD_POST, '/account/jwts', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => $cookie, + 'x-appwrite-project' => 'console', + ]), []); + $this->assertEquals(201, $jwt['headers']['status-code']); + $this->assertNotEmpty($jwt['body']['jwt']); + + $response = $proxyClient->call(Client::METHOD_GET, '/contact', headers: [ + 'cookie' => 'a_jwt_console=' . $jwt['body']['jwt'] + ], followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + $this->assertStringContainsString('/console/auth/preview', $response['headers']['location']); + + $this->cleanupSite($siteId); + } + + public function testInvalidSSRSource(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Astro SSR Site', + 'framework' => 'astro', + 'adapter' => 'ssr', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './dist', + 'buildCommand' => 'npm run build', + 'installCommand' => 'npm install', + ]); + + $this->assertNotEmpty($siteId); + + $site = $this->getSite($siteId); + $this->assertEquals(200, $site['headers']['status-code']); + $this->assertArrayHasKey('adapter', $site['body']); + $this->assertEquals('ssr', $site['body']['adapter']); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('astro-static'), + 'activate' => true + ]); + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status is failed, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + $this->cleanupSite($siteId); + } + + public function testDomainForFailedDeloyment(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Test Site', + 'framework' => 'astro', + 'buildRuntime' => 'node-22', + 'buildCommand' => 'cd random' + ]); + + $this->assertNotEmpty($siteId); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('astro'), + 'activate' => true + ]); + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals('failed', $deployment['body']['status'], json_encode($deployment['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertStringContainsString('This page is empty, activate a deployment to make it live.', $response['body']); + + $this->cleanupSite($siteId); + } + + public function testPermanentRedirect(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Sub project site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './' + ]); + $this->assertNotEmpty($siteId); + + $domain = $this->setupSiteDomain($siteId); + $this->assertNotEmpty($domain); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('sub-directories'), + 'activate' => 'true' + ]); + $this->assertNotEmpty($deploymentId); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertStringContainsString('Sub-directory index', $response['body']); + $response1 = $proxyClient->call(Client::METHOD_GET, '/project1'); + $this->assertEquals(200, $response1['headers']['status-code']); + $this->assertStringContainsString('Sub-directory project1', $response1['body']); + $response2 = $proxyClient->call(Client::METHOD_GET, '/project1/'); + $this->assertEquals(200, $response2['headers']['status-code']); + $this->assertStringContainsString('Sub-directory project1', $response2['body']); + $this->cleanupSite($siteId); + } + + public function testDeploymentCommandEscaping(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'A site', + 'framework' => 'other', + 'adapter' => 'static', + 'buildRuntime' => 'static-1', + 'outputDirectory' => './', + 'buildCommand' => "echo 'Hello two'", + 'installCommand' => 'echo "Hello one"', + 'fallbackFile' => '', + ]); + + $this->assertNotEmpty($siteId); + + $deploymentId = $this->setupDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'true' + ]); + + $this->assertNotEmpty($deploymentId); + + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertStringContainsString('Hello one', $deployment['body']['buildLogs']); + $this->assertStringContainsString('Hello two', $deployment['body']['buildLogs']); + + $this->cleanupSite($siteId); + } + + #[Retry(count: 3)] + public function testErrorPages(): void + { + // non-existent domain page + $domain = 'non-existent-page.sites.localhost'; + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $domain); + + $response = $proxyClient->call(Client::METHOD_GET, '/'); + + $this->assertEquals(404, $response['headers']['status-code']); + $this->assertStringContainsString('Nothing is here yet', $response['body']); + $this->assertStringContainsString('Start with this domain', $response['body']); + + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Static site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './', + 'buildCommand' => 'sleep 5 && cd non-existing-directory', + ]); + $this->assertNotEmpty($siteId); + + $domain = $this->setupSiteDomain($siteId); + + // test canceled deployment error page + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => 'true' + ]); + $deploymentId = $deployment['body']['$id'] ?? ''; + $this->assertEquals(202, $deployment['headers']['status-code']); + $this->assertNotEmpty($deployment['body']['$id']); + + $deployment = $this->cancelDeployment($siteId, $deploymentId); + $this->assertEquals(200, $deployment['headers']['status-code']); + $this->assertEquals('canceled', $deployment['body']['status']); + + $deploymentDomain = $this->getDeploymentDomain($deploymentId); + $this->assertNotEmpty($deploymentDomain); + + $proxyClient = new Client(); + $proxyClient->setEndpoint('http://' . $deploymentDomain); + $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + + $jwtObj = new JWT(System::getEnv('_APP_OPENSSL_KEY_V1'), 'HS256', 900, 0); + $apiKey = $jwtObj->encode([ + 'projectCheckDisabled' => true, + 'previewAuthDisabled' => true, + ]); + + $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false, headers: [ + 'x-appwrite-key' => API_KEY_DYNAMIC . '_' . $apiKey, + ]); + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertStringContainsString("Deployment build canceled", $response['body']); + $this->assertStringContainsString("View deployments", $response['body']); + + // check site domain for no active deployments + $proxyClient->setEndpoint('http://' . $domain); + $response = $proxyClient->call(Client::METHOD_GET, '/'); + $this->assertEquals(404, $response['headers']['status-code']); + $this->assertStringContainsString('No active deployments', $response['body']); + $this->assertStringContainsString('View deployments', $response['body']); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('astro'), + 'activate' => 'true' + ]); + + $deploymentId = $deployment['body']['$id'] ?? ''; + $this->assertNotEmpty($deploymentId); + + $deploymentDomain = $this->getDeploymentDomain($deploymentId); + $this->assertNotEmpty($deploymentDomain); + + $proxyClient->setEndpoint('http://' . $deploymentDomain); + $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false); + $this->assertEquals(301, $response['headers']['status-code']); + + // deployment is still building error page + $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false, headers: [ + 'x-appwrite-key' => API_KEY_DYNAMIC . '_' . $apiKey, + ]); + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertStringContainsString("Deployment is still building", $response['body']); + $this->assertStringContainsString("View logs", $response['body']); + $this->assertStringContainsString("Reload", $response['body']); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + + $this->assertEquals('failed', $deployment['body']['status']); + }, 50000, 500); + + // deployment failed error page + $response = $proxyClient->call(Client::METHOD_GET, '/', followRedirects: false, headers: [ + 'x-appwrite-key' => API_KEY_DYNAMIC . '_' . $apiKey, + ]); + $this->assertEquals(400, $response['headers']['status-code']); + $this->assertStringContainsString("Deployment build failed", $response['body']); + $this->assertStringContainsString("View logs", $response['body']); + + $this->cleanupSite($siteId); + } + + public function testEmptySiteSource(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Empty source site', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './', + ]); + $this->assertNotEmpty($siteId); + + // Prepare empty site folder + // We cant use .gitkeep, because that would make deployment non-empty + $stdout = ''; + $stderr = ''; + $folderPath = realpath(__DIR__ . '/../../../resources/sites') . '/empty'; + Console::execute("mkdir -p $folderPath", '', $stdout, $stderr); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('empty'), + 'activate' => true + ]); + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + $this->assertStringContainsString('Error:', $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + $this->cleanupSite($siteId); + } + + public function testOutputDirectoryEmpty(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Empty output directory', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './empty-directory', + 'buildCommand' => 'mkdir -p ./empty-directory' + ]); + $this->assertNotEmpty($siteId); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => true + ]); + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + $this->assertStringContainsString('Error:', $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + $this->cleanupSite($siteId); + } + + public function testOutputDirectoryMissing(): void + { + $siteId = $this->setupSite([ + 'siteId' => ID::unique(), + 'name' => 'Missing output directory', + 'framework' => 'other', + 'buildRuntime' => 'node-22', + 'outputDirectory' => './non-existing-directory', + ]); + $this->assertNotEmpty($siteId); + + $deployment = $this->createDeployment($siteId, [ + 'code' => $this->packageSite('static'), + 'activate' => true + ]); + $this->assertEquals(202, $deployment['headers']['status-code']); + + $deploymentId = $deployment['body']['$id']; + $this->assertNotEmpty($deploymentId); + + $this->assertEventually(function () use ($siteId, $deploymentId) { + $deployment = $this->getDeployment($siteId, $deploymentId); + $this->assertEquals('failed', $deployment['body']['status'], 'Deployment status does not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + $this->assertStringContainsString('No such file or directory', $deployment['body']['buildLogs'], 'Deployment logs do not match: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); + }, 100000, 500); + + $this->cleanupSite($siteId); + } +} diff --git a/tests/e2e/Services/Storage/StorageBase.php b/tests/e2e/Services/Storage/StorageBase.php index d2d75409b8..2b2c884283 100644 --- a/tests/e2e/Services/Storage/StorageBase.php +++ b/tests/e2e/Services/Storage/StorageBase.php @@ -13,6 +13,9 @@ use Utopia\Database\Validator\Datetime as DatetimeValidator; trait StorageBase { + /** + * @group fileTokens + */ public function testCreateBucketFile(): array { /** diff --git a/tests/e2e/Services/Teams/TeamsBaseClient.php b/tests/e2e/Services/Teams/TeamsBaseClient.php index 3fcd9c043d..1858fd50ad 100644 --- a/tests/e2e/Services/Teams/TeamsBaseClient.php +++ b/tests/e2e/Services/Teams/TeamsBaseClient.php @@ -337,18 +337,6 @@ trait TeamsBaseClient $this->assertEquals(400, $response['headers']['status-code']); - $response = $this->client->call(Client::METHOD_POST, '/teams/' . $teamUid . '/memberships', array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), [ - 'email' => $email, - 'name' => $name, - 'roles' => ['developer'], - 'url' => 'http://example.com/join-us#title' // bad url - ]); - - $this->assertEquals(400, $response['headers']['status-code']); - return [ 'teamUid' => $teamUid, 'teamName' => $teamName, diff --git a/tests/e2e/Services/Teams/TeamsConsoleClientTest.php b/tests/e2e/Services/Teams/TeamsConsoleClientTest.php index 06358765f6..f096831a76 100644 --- a/tests/e2e/Services/Teams/TeamsConsoleClientTest.php +++ b/tests/e2e/Services/Teams/TeamsConsoleClientTest.php @@ -14,6 +14,30 @@ class TeamsConsoleClientTest extends Scope use ProjectConsole; use SideClient; + /** + * @depends testCreateTeam + */ + public function testTeamCreateMembershipConsole($data): array + { + $teamUid = $data['teamUid'] ?? ''; + $email = uniqid() . 'friend@localhost.test'; + $name = 'Friend User'; + + $response = $this->client->call(Client::METHOD_POST, '/teams/' . $teamUid . '/memberships', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'email' => $email, + 'name' => $name, + 'roles' => ['developer'], + 'url' => 'http://example.com/join-us#title' // bad url + ]); + + $this->assertEquals(400, $response['headers']['status-code']); + + return $data; + } + /** * @depends testCreateTeam */ diff --git a/tests/e2e/Services/Tokens/TokensBase.php b/tests/e2e/Services/Tokens/TokensBase.php new file mode 100644 index 0000000000..af93f5fc73 --- /dev/null +++ b/tests/e2e/Services/Tokens/TokensBase.php @@ -0,0 +1,278 @@ +<?php + +namespace Tests\E2E\Services\Tokens; + +use CURLFile; +use Tests\E2E\Client; +use Utopia\Database\Helpers\ID; + +trait TokensBase +{ + public function testCreateBucketAndFile(): array + { + $bucket = $this->client->call( + Client::METHOD_POST, + '/storage/buckets', + [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], + [ + 'name' => 'Test Bucket', + 'bucketId' => ID::unique(), + 'allowedFileExtensions' => ['jpg', 'png', 'jfif'], + ] + ); + + $this->assertEquals(201, $bucket['headers']['status-code']); + $this->assertNotEmpty($bucket['body']['$id']); + + $bucketId = $bucket['body']['$id']; + + $file = $this->client->call( + Client::METHOD_POST, + '/storage/buckets/' . $bucketId . '/files', + [ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], + [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + ] + ); + + $this->assertEquals(201, $file['headers']['status-code']); + $this->assertNotEmpty($file['body']['$id']); + + $fileId = $file['body']['$id']; + + $token = $this->client->call( + Client::METHOD_POST, + '/tokens/buckets/' . $bucketId . '/files/' . $fileId, + [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ] + ); + + $this->assertEquals(201, $token['headers']['status-code']); + $this->assertEquals($bucketId . ':' . $fileId, $token['body']['resourceId']); + $this->assertEquals(TOKENS_RESOURCE_TYPE_FILES, $token['body']['resourceType']); + + return [ + 'fileId' => $fileId, + 'bucketId' => $bucketId, + 'token' => $token['body'], + 'guestHeaders' => [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], + ]; + } + + /** + * @depends testCreateBucketAndFile + */ + public function testFailuresWithoutToken(array $data): array + { + $fileId = $data['fileId']; + $bucketId = $data['bucketId']; + $guestHeaders = $data['guestHeaders']; + + // File preview. Should fail as an anonymous user with no form of any access to the file. + $failedPreview = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', + $guestHeaders + ); + $this->assertEquals(401, $failedPreview['body']['code']); + $this->assertEquals(401, $failedPreview['headers']['status-code']); + $this->assertEquals('user_unauthorized', $failedPreview['body']['type']); + $this->assertEquals('The current user is not authorized to perform the requested action.', $failedPreview['body']['message']); + + // Extended file preview. Should fail as an anonymous user with no form of any access to the file. + $failedCustomPreview = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', + $guestHeaders, + [ + 'width' => 300, + 'height' => 100, + 'borderRadius' => '50', + 'opacity' => '0.5', + 'output' => 'png', + 'rotation' => '45' + ] + ); + $this->assertEquals(401, $failedCustomPreview['body']['code']); + $this->assertEquals(401, $failedCustomPreview['headers']['status-code']); + $this->assertEquals('user_unauthorized', $failedCustomPreview['body']['type']); + $this->assertEquals('The current user is not authorized to perform the requested action.', $failedCustomPreview['body']['message']); + + // File view. Should fail as an anonymous user with no form of any access to the file. + $failedView = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/view', + $guestHeaders + ); + $this->assertEquals(401, $failedView['body']['code']); + $this->assertEquals(401, $failedView['headers']['status-code']); + $this->assertEquals('user_unauthorized', $failedView['body']['type']); + $this->assertEquals('The current user is not authorized to perform the requested action.', $failedView['body']['message']); + + // File download. Should fail as an anonymous user with no form of any access to the file. + $failedDownload = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/download', + $guestHeaders + ); + $this->assertEquals(401, $failedDownload['body']['code']); + $this->assertEquals(401, $failedDownload['headers']['status-code']); + $this->assertEquals('user_unauthorized', $failedDownload['body']['type']); + $this->assertEquals('The current user is not authorized to perform the requested action.', $failedDownload['body']['message']); + + return $data; + } + + /** + * @depends testCreateBucketAndFile + */ + public function testPreviewFileWithToken(array $data): array + { + $token = $data['token']; + $fileId = $data['fileId']; + $bucketId = $data['bucketId']; + $guestHeaders = $data['guestHeaders']; + + $tokenJWT = $token['secret']; + + // Generate a preview + $filePreview = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview', + $guestHeaders, + [ + 'token' => $tokenJWT + ] + ); + $this->assertEquals(200, $filePreview['headers']['status-code']); + $this->assertEquals('image/png', $filePreview['headers']['content-type']); + $this->assertNotEmpty($filePreview['body']); + + $image = new \Imagick(); + $image->readImageBlob($filePreview['body']); + $original = new \Imagick(__DIR__ . '/../../../resources/logo.png'); + + $this->assertEquals($image->getImageWidth(), $original->getImageWidth()); + $this->assertEquals($image->getImageHeight(), $original->getImageHeight()); + $this->assertEquals('PNG', $image->getImageFormat()); + + $data['jwtToken'] = $tokenJWT; + return $data; + } + + /** + * @depends testPreviewFileWithToken + */ + public function testCustomPreviewFileWithToken(array $data): array + { + $fileId = $data['fileId']; + $bucketId = $data['bucketId']; + $jwtToken = $data['jwtToken']; + $guestHeaders = $data['guestHeaders']; + + // Generate an extended preview + $customFilePreview = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/preview/', + $guestHeaders, + [ + 'width' => 300, + 'height' => 100, + 'borderRadius' => '50', + 'opacity' => '0.5', + 'output' => 'png', + 'rotation' => '45', + 'token' => $jwtToken + ] + ); + + $this->assertEquals(200, $customFilePreview['headers']['status-code']); + $this->assertEquals('image/png', $customFilePreview['headers']['content-type']); + $this->assertNotEmpty($customFilePreview['body']); + + $image = new \Imagick(); + $image->readImageBlob($customFilePreview['body']); + $original = new \Imagick(__DIR__ . '/../../../resources/logo-after.png'); + + $this->assertEquals($image->getImageWidth(), $original->getImageWidth()); + $this->assertEquals($image->getImageHeight(), $original->getImageHeight()); + $this->assertEquals('PNG', $image->getImageFormat()); + + return $data; + } + + /** + * @depends testPreviewFileWithToken + */ + public function testViewFileWithToken(array $data): void + { + $fileId = $data['fileId']; + $bucketId = $data['bucketId']; + $jwtToken = $data['jwtToken']; + $guestHeaders = $data['guestHeaders']; + + $fileView = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/view', + $guestHeaders, + [ + 'token' => $jwtToken + ] + ); + + $this->assertEquals(200, $fileView['headers']['status-code']); + + $image = new \Imagick(); + $image->readImageBlob($fileView['body']); + $original = new \Imagick(__DIR__ . '/../../../resources/logo.png'); + + $this->assertEquals($image->getImageWidth(), $original->getImageWidth()); + $this->assertEquals($image->getImageHeight(), $original->getImageHeight()); + $this->assertEquals('PNG', $image->getImageFormat()); + } + + /** + * @depends testPreviewFileWithToken + */ + public function testDownloadFileWithToken(array $data): void + { + $fileId = $data['fileId']; + $bucketId = $data['bucketId']; + $jwtToken = $data['jwtToken']; + $guestHeaders = $data['guestHeaders']; + + $fileFailedDownload = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $bucketId . '/files/' . $fileId . '/download', + $guestHeaders, + [ + 'token' => $jwtToken + ] + ); + + $this->assertEquals(200, $fileFailedDownload['headers']['status-code']); + + $image = new \Imagick(); + $image->readImageBlob($fileFailedDownload['body']); + $original = new \Imagick(__DIR__ . '/../../../resources/logo.png'); + + $this->assertEquals($image->getImageWidth(), $original->getImageWidth()); + $this->assertEquals($image->getImageHeight(), $original->getImageHeight()); + $this->assertEquals('PNG', $image->getImageFormat()); + } +} diff --git a/tests/e2e/Services/Tokens/TokensConsoleClientTest.php b/tests/e2e/Services/Tokens/TokensConsoleClientTest.php new file mode 100644 index 0000000000..4a7aab474a --- /dev/null +++ b/tests/e2e/Services/Tokens/TokensConsoleClientTest.php @@ -0,0 +1,144 @@ +<?php + +namespace Tests\E2E\Services\Tokens; + +use CURLFile; +use Tests\E2E\Client; +use Tests\E2E\Scopes\ProjectCustom; +use Tests\E2E\Scopes\Scope; +use Tests\E2E\Scopes\SideServer; +use Utopia\Database\DateTime; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\Datetime as DatetimeValidator; + +class TokensConsoleClientTest extends Scope +{ + use TokensBase; + use ProjectCustom; + use SideServer; + + public function testCreateToken(): array + { + + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ], $this->getHeaders()), [ + 'bucketId' => ID::unique(), + 'name' => 'Test Bucket', + 'fileSecurity' => true, + 'maximumFileSize' => 2000000, //2MB + 'allowedFileExtensions' => ['jpg', 'png', 'jfif'], + 'permissions' => [ + Permission::read(Role::any()), + Permission::create(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + ]); + $this->assertEquals(201, $bucket['headers']['status-code']); + $this->assertNotEmpty($bucket['body']['$id']); + + $bucketId = $bucket['body']['$id']; + + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + ]); + $this->assertEquals(201, $file['headers']['status-code']); + $this->assertNotEmpty($file['body']['$id']); + + $fileId = $file['body']['$id']; + + $token = $this->client->call(Client::METHOD_POST, '/tokens/buckets/' . $bucketId . '/files/' . $fileId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ], $this->getHeaders())); + + $this->assertEquals(201, $token['headers']['status-code']); + $this->assertEquals('files', $token['body']['resourceType']); + + return [ + 'fileId' => $fileId, + 'bucketId' => $bucketId, + 'tokenId' => $token['body']['$id'], + ]; + } + + /** + * @depends testCreateToken + */ + public function testUpdateToken(array $data): array + { + $tokenId = $data['tokenId']; + + // Finite expiry + $expiry = DateTime::addSeconds(new \DateTime(), 3600); + $token = $this->client->call(Client::METHOD_PATCH, '/tokens/' . $tokenId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ], $this->getHeaders()), [ + 'expire' => $expiry, + ]); + + $dateValidator = new DatetimeValidator(); + $this->assertTrue($dateValidator->isValid($token['body']['expire'])); + + // Infinite expiry + $token = $this->client->call(Client::METHOD_PATCH, '/tokens/' . $tokenId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ], $this->getHeaders()), [ + 'expire' => null, + ]); + + $this->assertEmpty($token['body']['expire']); + + return $data; + } + + /** + * @depends testCreateToken + */ + public function testListTokens(array $data): array + { + $res = $this->client->call( + Client::METHOD_GET, + '/tokens/buckets/' . $data['bucketId'] . '/files/' . $data['fileId'], + array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ], $this->getHeaders()) + ); + + $this->assertIsArray($res['body']); + $this->assertEquals(200, $res['headers']['status-code']); + return $data; + } + + /** + * @depends testUpdateToken + */ + public function testDeleteToken(array $data): array + { + $tokenId = $data['tokenId']; + + $res = $this->client->call(Client::METHOD_DELETE, '/tokens/' . $tokenId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ], $this->getHeaders())); + + $this->assertEquals(204, $res['headers']['status-code']); + return $data; + } +} diff --git a/tests/e2e/Services/Tokens/TokensCustomClientTest.php b/tests/e2e/Services/Tokens/TokensCustomClientTest.php new file mode 100644 index 0000000000..a7a1fa48a5 --- /dev/null +++ b/tests/e2e/Services/Tokens/TokensCustomClientTest.php @@ -0,0 +1,15 @@ +<?php + +namespace Tests\E2E\Services\Tokens; + +use Tests\E2E\Scopes\ProjectCustom; +use Tests\E2E\Scopes\Scope; +use Tests\E2E\Scopes\SideClient; + +class TokensCustomClientTest extends Scope +{ + use TokensBase; + use ProjectCustom; + use SideClient; + +} diff --git a/tests/e2e/Services/Tokens/TokensCustomServerTest.php b/tests/e2e/Services/Tokens/TokensCustomServerTest.php new file mode 100644 index 0000000000..fe8fa2bad9 --- /dev/null +++ b/tests/e2e/Services/Tokens/TokensCustomServerTest.php @@ -0,0 +1,148 @@ +<?php + +namespace Tests\E2E\Services\Tokens; + +use CURLFile; +use Tests\E2E\Client; +use Tests\E2E\Scopes\ProjectCustom; +use Tests\E2E\Scopes\Scope; +use Tests\E2E\Scopes\SideServer; +use Utopia\Database\DateTime; +use Utopia\Database\Helpers\ID; +use Utopia\Database\Helpers\Permission; +use Utopia\Database\Helpers\Role; +use Utopia\Database\Validator\Datetime as DatetimeValidator; + +class TokensCustomServerTest extends Scope +{ + use TokensBase; + use ProjectCustom; + use SideServer; + + public function testCreateToken(): array + { + + $bucket = $this->client->call(Client::METHOD_POST, '/storage/buckets', [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'bucketId' => ID::unique(), + 'name' => 'Test Bucket', + 'fileSecurity' => true, + 'maximumFileSize' => 2000000, //2MB + 'allowedFileExtensions' => ['jpg', 'png', 'jfif'], + 'permissions' => [ + Permission::read(Role::any()), + Permission::create(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + ]); + $this->assertEquals(201, $bucket['headers']['status-code']); + $this->assertNotEmpty($bucket['body']['$id']); + + $bucketId = $bucket['body']['$id']; + + $file = $this->client->call(Client::METHOD_POST, '/storage/buckets/' . $bucketId . '/files', array_merge([ + 'content-type' => 'multipart/form-data', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'fileId' => ID::unique(), + 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), + 'permissions' => [ + Permission::read(Role::any()), + Permission::update(Role::any()), + Permission::delete(Role::any()), + ], + ]); + $this->assertEquals(201, $file['headers']['status-code']); + $this->assertNotEmpty($file['body']['$id']); + + $fileId = $file['body']['$id']; + + $token = $this->client->call(Client::METHOD_POST, '/tokens/buckets/' . $bucketId . '/files/' . $fileId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'] + ], $this->getHeaders())); + + $this->assertEquals(201, $token['headers']['status-code']); + $this->assertEquals('files', $token['body']['resourceType']); + + return [ + 'fileId' => $fileId, + 'bucketId' => $bucketId, + 'tokenId' => $token['body']['$id'], + ]; + } + + /** + * @depends testCreateToken + */ + public function testUpdateToken(array $data): array + { + $tokenId = $data['tokenId']; + + // Finite expiry + $expiry = DateTime::addSeconds(new \DateTime(), 3600); + $token = $this->client->call(Client::METHOD_PATCH, '/tokens/' . $tokenId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ], [ + 'expire' => $expiry, + ]); + + $dateValidator = new DatetimeValidator(); + $this->assertTrue($dateValidator->isValid($token['body']['expire'])); + + // Infinite expiry + $token = $this->client->call(Client::METHOD_PATCH, '/tokens/' . $tokenId, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'expire' => null, + ]); + + $this->assertEmpty($token['body']['expire']); + + return $data; + } + + /** + * @depends testCreateToken + */ + public function testListTokens(array $data): array + { + $res = $this->client->call( + Client::METHOD_GET, + '/tokens/buckets/' . $data['bucketId'] . '/files/' . $data['fileId'], + [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ] + ); + + $this->assertIsArray($res['body']); + $this->assertEquals(200, $res['headers']['status-code']); + return $data; + } + + /** + * @depends testUpdateToken + */ + public function testDeleteToken(array $data): array + { + $tokenId = $data['tokenId']; + + $res = $this->client->call(Client::METHOD_DELETE, '/tokens/' . $tokenId, [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]); + + $this->assertEquals(204, $res['headers']['status-code']); + return $data; + } +} diff --git a/tests/e2e/Services/Users/UsersBase.php b/tests/e2e/Services/Users/UsersBase.php index 04e0eb5bc3..00e999672f 100644 --- a/tests/e2e/Services/Users/UsersBase.php +++ b/tests/e2e/Services/Users/UsersBase.php @@ -801,6 +801,97 @@ trait UsersBase return $data; } + /** + * @depends testGetUser + */ + public function testListUserMemberships(array $data): array + { + /** + * Test for SUCCESS + */ + + // create a new team + $team = $this->client->call(Client::METHOD_POST, '/teams', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'teamId' => 'unique()', + 'name' => 'Test Team', + ]); + + // create a new membership + $membership = $this->client->call(Client::METHOD_POST, '/teams/' . $team['body']['$id'] . '/memberships', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'userId' => $data['userId'], + 'roles' => ['new-role'], + ]); + + // list the memberships + $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/memberships', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals($response['headers']['status-code'], 200); + $this->assertEquals($response['body']['memberships'][0]['$id'], $membership['body']['$id']); + $this->assertEquals($response['body']['memberships'][0]['roles'], ['new-role']); + $this->assertEquals($response['body']['total'], 1); + + // create another membership with a new role + $team = $this->client->call(Client::METHOD_POST, '/teams', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'teamId' => 'unique()', + 'name' => 'Test Team 2', + ]); + + $membership = $this->client->call(Client::METHOD_POST, '/teams/' . $team['body']['$id'] . '/memberships', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'userId' => $data['userId'], + 'roles' => ['new-role-2'], + ]); + + // list out memberships and query by role + $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/memberships', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::contains('roles', ['new-role-2'])->toString() + ] + ]); + + $this->assertEquals($response['headers']['status-code'], 200); + $this->assertEquals($response['body']['memberships'][0]['$id'], $membership['body']['$id']); + $this->assertEquals($response['body']['memberships'][0]['roles'], ['new-role-2']); + $this->assertEquals($response['body']['total'], 1); + + /** + * Test for FAILURE + */ + + // query using equal on array field + $response = $this->client->call(Client::METHOD_GET, '/users/' . $data['userId'] . '/memberships', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'queries' => [ + Query::equal('roles', ['new-role-2'])->toString() + ] + ]); + + $this->assertEquals($response['body']['code'], 400); + $this->assertEquals($response['body']['message'], 'Invalid `queries` param: Invalid query: Cannot query equal on attribute "roles" because it is an array.'); + $this->assertEquals($response['body']['type'], 'general_argument_invalid'); + + return $data; + } + /** * @depends testGetUser */ diff --git a/tests/e2e/Services/VCS/VCSConsoleClientTest.php b/tests/e2e/Services/VCS/VCSConsoleClientTest.php index f04667a0f5..13c3ddb251 100644 --- a/tests/e2e/Services/VCS/VCSConsoleClientTest.php +++ b/tests/e2e/Services/VCS/VCSConsoleClientTest.php @@ -22,6 +22,8 @@ class VCSConsoleClientTest extends Scope public string $providerInstallationId = '42954928'; // appwrite-test public string $providerRepositoryId = '705764267'; // ruby-starter (public) public string $providerRepositoryId2 = '708688544'; // function1.4 (private) + public string $providerRepositoryId3 = '943139433'; // svelte-starter (public) + public string $providerRepositoryId4 = '943245292'; // templates-for-sites (public) public function testGitHubAuthorize(): string { @@ -67,24 +69,102 @@ class VCSConsoleClientTest extends Scope * Test for SUCCESS */ - $runtime = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId . '/detection', array_merge([ + $runtime = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + 'content-type' => 'application/json', + ], $this->getHeaders()), [ + 'providerRepositoryId' => $this->providerRepositoryId, + 'type' => 'runtime', + ]); $this->assertEquals(200, $runtime['headers']['status-code']); - $this->assertEquals($runtime['body']['runtime'], 'ruby-3.1'); + $this->assertEquals($runtime['body']['runtime'], 'ruby-3.3'); + $this->assertEquals($runtime['body']['commands'], 'bundle install && bundle exec rake build'); + $this->assertEquals($runtime['body']['entrypoint'], 'main.rb'); /** * Test for FAILURE */ - $runtime = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/providerRepositories/randomRepositoryId/detection', array_merge([ + $runtime = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + 'content-type' => 'application/json', + ], $this->getHeaders()), [ + 'providerRepositoryId' => 'randomRepositoryId', // Invalid repository ID + 'type' => 'runtime', + ]); $this->assertEquals(404, $runtime['headers']['status-code']); } + /** + * @depends testGitHubAuthorize + */ + public function testDetectFramework(string $installationId) + { + /** + * Test for SUCCESS + */ + + $framework = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + 'content-type' => 'application/json', + ], $this->getHeaders()), [ + 'providerRepositoryId' => $this->providerRepositoryId3, + 'type' => 'framework', + ]); + + $this->assertEquals(200, $framework['headers']['status-code']); + $this->assertEquals($framework['body']['framework'], 'sveltekit'); + $this->assertEquals($framework['body']['installCommand'], 'npm install'); + $this->assertEquals($framework['body']['buildCommand'], 'npm run build'); + $this->assertEquals($framework['body']['outputDirectory'], './build'); + + $framework = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + 'content-type' => 'application/json', + ], $this->getHeaders()), [ + 'providerRepositoryId' => $this->providerRepositoryId4, + 'type' => 'framework', + 'providerRootDirectory' => 'astro/starter' + ]); + + $this->assertEquals(200, $framework['headers']['status-code']); + $this->assertEquals($framework['body']['framework'], 'astro'); + $this->assertEquals($framework['body']['installCommand'], 'npm install'); + $this->assertEquals($framework['body']['buildCommand'], 'npm run build'); + $this->assertEquals($framework['body']['outputDirectory'], './dist'); + + $framework = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + 'content-type' => 'application/json', + ], $this->getHeaders()), [ + 'providerRepositoryId' => $this->providerRepositoryId4, + 'type' => 'framework', + 'providerRootDirectory' => 'remix/starter' + ]); + + $this->assertEquals(200, $framework['headers']['status-code']); + $this->assertEquals($framework['body']['framework'], 'remix'); + $this->assertEquals($framework['body']['installCommand'], 'npm install'); + $this->assertEquals($framework['body']['buildCommand'], 'npm run build'); + $this->assertEquals($framework['body']['outputDirectory'], './build'); + + /** + * Test for FAILURE + */ + + $framework = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/detections', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + 'content-type' => 'application/json', + ], $this->getHeaders()), [ + 'providerRepositoryId' => 'randomRepositoryId', // Invalid repository ID + 'type' => 'framework', + ]); + + $this->assertEquals(404, $framework['headers']['status-code']); + } + /** * @depends testGitHubAuthorize */ @@ -94,7 +174,7 @@ class VCSConsoleClientTest extends Scope * Test for SUCCESS */ - $runtime = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId . '/contents', array_merge([ + $runtime = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId . '/contents', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); @@ -126,7 +206,7 @@ class VCSConsoleClientTest extends Scope $this->assertTrue($libContent['isDirectory']); $this->assertEquals(0, $gemfileContent['size']); - $runtime = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId . '/contents?providerRootDirectory=lib', array_merge([ + $runtime = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories/' . $this->providerRepositoryId . '/contents?providerRootDirectory=lib', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); @@ -150,7 +230,7 @@ class VCSConsoleClientTest extends Scope * Test for FAILURE */ - $runtime = $this->client->call(Client::METHOD_POST, '/vcs/github/installations/' . $installationId . '/providerRepositories/randomRepositoryId/contents', array_merge([ + $runtime = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories/randomRepositoryId/contents', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders())); @@ -168,26 +248,75 @@ class VCSConsoleClientTest extends Scope $repositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), [ + 'type' => 'runtime' + ]); $this->assertEquals(200, $repositories['headers']['status-code']); - $this->assertEquals($repositories['body']['total'], 3); - $this->assertEquals($repositories['body']['providerRepositories'][0]['name'], 'function1.4'); - $this->assertEquals($repositories['body']['providerRepositories'][0]['organization'], 'appwrite-test'); - $this->assertEquals($repositories['body']['providerRepositories'][0]['provider'], 'github'); - $this->assertEquals($repositories['body']['providerRepositories'][1]['name'], 'appwrite'); - $this->assertEquals($repositories['body']['providerRepositories'][2]['name'], 'ruby-starter'); - + $this->assertEquals($repositories['body']['total'], 4); + $this->assertEquals($repositories['body']['runtimeProviderRepositories'][0]['name'], 'starter-for-svelte'); + $this->assertEquals($repositories['body']['runtimeProviderRepositories'][0]['organization'], 'appwrite-test'); + $this->assertEquals($repositories['body']['runtimeProviderRepositories'][0]['provider'], 'github'); + $this->assertEquals($repositories['body']['runtimeProviderRepositories'][0]['runtime'], 'node-22'); $searchedRepositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], ], $this->getHeaders()), [ - 'search' => 'func' + 'search' => 'function1.4', + 'type' => 'runtime' ]); - $this->assertEquals(200, $searchedRepositories['headers']['status-code']); $this->assertEquals($searchedRepositories['body']['total'], 1); - $this->assertEquals($searchedRepositories['body']['providerRepositories'][0]['name'], 'function1.4'); + $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['name'], 'function1.4'); + $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime'], 'node-2'); + + $searchedRepositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'search' => 'appwrite', + 'type' => 'runtime' + ]); + $this->assertEquals(200, $searchedRepositories['headers']['status-code']); + $this->assertEquals($searchedRepositories['body']['total'], 1); + $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['name'], 'appwrite'); + $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime'], 'php-8.3'); + + $searchedRepositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'search' => 'ruby-starter', + 'type' => 'runtime' + ]); + $this->assertEquals(200, $searchedRepositories['headers']['status-code']); + $this->assertEquals($searchedRepositories['body']['total'], 1); + $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['name'], 'ruby-starter'); + $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime'], 'ruby-3.3'); + + $repositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'type' => 'framework' + ]); + + $this->assertEquals(200, $repositories['headers']['status-code']); + $this->assertEquals($repositories['body']['total'], 4); + $this->assertEquals($repositories['body']['frameworkProviderRepositories'][0]['name'], 'starter-for-svelte'); + $this->assertEquals($repositories['body']['frameworkProviderRepositories'][0]['organization'], 'appwrite-test'); + $this->assertEquals($repositories['body']['frameworkProviderRepositories'][0]['provider'], 'github'); + $this->assertEquals($repositories['body']['frameworkProviderRepositories'][0]['framework'], 'sveltekit'); + + $searchedRepositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'search' => 'appwrite', + 'type' => 'runtime' + ]); + $this->assertEquals(200, $searchedRepositories['headers']['status-code']); + $this->assertEquals($searchedRepositories['body']['total'], 1); + $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['name'], 'appwrite'); + $this->assertEquals($searchedRepositories['body']['runtimeProviderRepositories'][0]['runtime'], 'other'); + + // TODO: If you are about to add another check, rewrite this to @provideScenarios /** * Test for FAILURE @@ -195,9 +324,29 @@ class VCSConsoleClientTest extends Scope $repositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/randomInstallationId/providerRepositories', array_merge([ 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), [ + 'type' => 'runtime' + ]); $this->assertEquals(404, $repositories['headers']['status-code']); + + $repositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'type' => 'randomType' + ]); + + $this->assertEquals(400, $repositories['headers']['status-code']); + + $repositories = $this->client->call(Client::METHOD_GET, '/vcs/github/installations/' . $installationId . '/providerRepositories', array_merge([ + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'search' => 'randomSearch', + 'type' => 'framework' + ]); + + $this->assertEquals(200, $repositories['headers']['status-code']); + $this->assertEquals($repositories['body']['total'], 0); } /** diff --git a/tests/resources/csv/documents.csv b/tests/resources/csv/documents.csv new file mode 100644 index 0000000000..ea1e33b5bd --- /dev/null +++ b/tests/resources/csv/documents.csv @@ -0,0 +1,101 @@ +$id,name,age +hxfcwpcas5xokpwe,Diamond Mendez,56 +gw8nxwf6esn3tfwf,Michael Huff,20 +xb6bxg56lral1qy9,Alyssa Rodriguez,37 +imerjq5j36y3agh2,Barbara Smith,26 +07yq9qdlhmbzmr35,Evelyn Edwards,54 +ksqo631sbhwj5ltg,Tina Richardson,41 +j7zlndgu0gbshp15,Joel Hernandez,49 +mfntvnljrcmf7h6v,Zachary Cooper,59 +5f9b01nziqu2h8ed,Brittany Spears,20 +4vxzbnzraqznk5u8,Holly White,47 +d4ywy3mtphaatbpf,Kimberly Barnes,27 +88odnk6nthyyvbal,Stephen Miller,53 +08oekee3fn7mzaa5,Yvonne Newman,41 +quw55kn9895i5e4v,Carol Kane,38 +nge6bm8ykripei6f,Doris Foster,44 +4k16i33s0xl2ypx9,Joseph Stokes,28 +q0j5rxbgid66snyf,Steve Williams,31 +n1oxun7mqq3p103y,James Carey,29 +0dbvs840jkf8i0ye,Kathryn Henry,38 +5sfaidgs1h87v15v,Christopher Landry,23 +vg3punvfu5khmf41,Jennifer Mcgee,62 +f933qydr9u5b2r11,Cathy Church,35 +wjv87y1inf8yk32s,Jose Lopez,41 +uljysdvdlcyrbrwk,William Rose,30 +ot8xtzh77j55wq0s,Sarah Ford,26 +9t76vnsv2u36s43t,Alisha Jones,61 +66y4tnty62hw8c02,Kristin Kelly,61 +2punfblazi5v16ar,Brendan Stout,40 +sxhr4nf5w2gx4wbg,Kelly Cruz,18 +68dvrqfwqnkq5el9,Samantha Martin,50 +20192l6dbeinhkh0,David Santos,46 +si0l4dgay09ebfmf,Elizabeth Carroll,22 +lhse40vbldqb6ap1,Corey Owens,46 +h5t3pslykyx3kxfm,Shelby Mueller,65 +ldc0luydrw6jub0f,Dr. Sylvia Myers,29 +voc9628xg4dsgw2y,Scott Freeman,48 +o4y0gk3gqv1ax2fz,Christopher Atkinson,21 +u1n3x4e4u7e0vzj6,Sean Diaz,31 +s36eskwtm0w7lwr7,Bobby Dyer,57 +4hjnag1p5iwvtixd,Daniel Hall,62 +m91d80oxsa216zbh,Jennifer Ramirez,65 +5hj6858zo2g85n6v,Angela Jackson,57 +8m8oihv9a1e7nn92,Kelly Lewis,36 +7azy39la0no0mxi7,Jessica Munoz,55 +47pmjkhnnqhyit8c,Kelly George,65 +6j6cpy4kgneg1mmh,Anthony Johnson,65 +tnlmtvap1zz89km9,Regina Fields,61 +6cyuvnwwqdmrpfzh,Sharon Schaefer,30 +p1v4pyu2pqodc0ey,Jacob French,62 +6npynnhjt2jd05xo,Jessica Costa,23 +wcxedf13n2e9qi4l,George Hardy,53 +yf2xlcmszk2tqeig,Andrea Allison,20 +3bf2zzv7poststwa,Kevin Ferguson,32 +c2iataz0hhv39q63,Joseph Johnson,58 +3e8npxhov4a39pvq,Ashley Martinez,18 +t7dp41tysipytywq,Charles Nixon,23 +z8cztq7c47phyfhk,Carol Dudley,40 +2636f9d8r4ipm3h6,David Weber,51 +eh3f6wxtvkjq6ykq,Scott Robinson,32 +raskbwpsje69a59h,Anthony Hardy,38 +90hn1p0b4cs9e2og,Mackenzie Owens,52 +am3swwfbo076x0v1,Brian Foster,27 +5uw7utb9lq5cfncw,Hannah Forbes,56 +cs6mbfzkzifefx6r,Lauren Reed,26 +ftw3uvztziiz9x00,Morgan Smith,28 +uhrqseeo43mozpaq,Samantha Alexander,65 +pvvmzyfc1lxor11e,Tiffany Roberts,20 +jia7bdag4abz123s,Emily Hayes,34 +h6oozcngbz8o5x4y,Rebecca Villegas,52 +9v6z1pn2f9twcy12,Donald Shah,61 +wzz3jduioso77o7f,Denise Cain,59 +u51plhgvjodkswnr,Kristine Ramirez,53 +t1uhkmiytfyc13vc,Stacey Adkins,61 +iqaqnf0ybg2ct507,Daniel Hunt,20 +idwrwv2uu4hcpv2i,Roberta Johnson,48 +2yd2hd6auetjacyo,Jason Williamson,39 +egrmdbibnjhi914x,Sandra Robinson,50 +15m1pz2bb0ercgyk,Steve Rice,25 +0i21bhkxdagjurb7,Kimberly Fritz,53 +726ofi7h5snreq67,Brianna Reynolds,33 +csqxse3wym56eim6,Alexander Williams,50 +qeaoylnrsf8p3byg,Andrew Thomas,25 +edsswobumzyzbvhf,Austin Williams,57 +hdzhzpt0ahy5hkib,Nicholas Williams,24 +w1qmvmg4roa8xnwu,Mrs. Michelle Cisneros,48 +3z3o73x7adyuo6w0,Stacey Smith,39 +sse2u5zlgoqrgmcf,Laura Beck,20 +rvovijmvch58r4yx,Molly Clark,51 +doe06nrx8sg5mcuv,Carmen Morris,41 +jbjdwuvj5s4kw04y,Amanda Munoz,20 +6k2ewkla7js0yw23,Rachel Collins,44 +fcxuyr4kkhrnigu1,John Alexander,18 +d25fuwlos5mk07o0,Stacy Hunter,22 +1vdai2rxmwd57oet,Eric Massey,40 +pq4jnt9izu1wlrzd,Scott Garcia,20 +lz9kfc0lty5xcz14,Cassandra Nelson,35 +pu7w6tyab5jd4we9,Aaron Johnson,50 +8dupswd2kqwdyn8v,Shannon Sherman,45 +ye466l71jthiz2p6,April Garcia,60 +xogsmfwb73l16qdt,Evan Lynn,20 diff --git a/tests/resources/csv/irrelevant-column.csv b/tests/resources/csv/irrelevant-column.csv new file mode 100644 index 0000000000..92105ceaa2 --- /dev/null +++ b/tests/resources/csv/irrelevant-column.csv @@ -0,0 +1,101 @@ +$id,name,age,email +hxfcwpcas5xokpwe,Diamond Mendez,56,diamond.mendez@example.com +gw8nxwf6esn3tfwf,Michael Huff,20,michael.huff@example.com +xb6bxg56lral1qy9,Alyssa Rodriguez,37,alyssa.rodriguez@example.com +imerjq5j36y3agh2,Barbara Smith,26,barbara.smith@example.com +07yq9qdlhmbzmr35,Evelyn Edwards,54,evelyn.edwards@example.com +ksqo631sbhwj5ltg,Tina Richardson,41,tina.richardson@example.com +j7zlndgu0gbshp15,Joel Hernandez,49,joel.hernandez@example.com +mfntvnljrcmf7h6v,Zachary Cooper,59,zachary.cooper@example.com +5f9b01nziqu2h8ed,Brittany Spears,20,brittany.spears@example.com +4vxzbnzraqznk5u8,Holly White,47,holly.white@example.com +d4ywy3mtphaatbpf,Kimberly Barnes,27,kimberly.barnes@example.com +88odnk6nthyyvbal,Stephen Miller,53,stephen.miller@example.com +08oekee3fn7mzaa5,Yvonne Newman,41,yvonne.newman@example.com +quw55kn9895i5e4v,Carol Kane,38,carol.kane@example.com +nge6bm8ykripei6f,Doris Foster,44,doris.foster@example.com +4k16i33s0xl2ypx9,Joseph Stokes,28,joseph.stokes@example.com +q0j5rxbgid66snyf,Steve Williams,31,steve.williams@example.com +n1oxun7mqq3p103y,James Carey,29,james.carey@example.com +0dbvs840jkf8i0ye,Kathryn Henry,38,kathryn.henry@example.com +5sfaidgs1h87v15v,Christopher Landry,23,christopher.landry@example.com +vg3punvfu5khmf41,Jennifer Mcgee,62,jennifer.mcgee@example.com +f933qydr9u5b2r11,Cathy Church,35,cathy.church@example.com +wjv87y1inf8yk32s,Jose Lopez,41,jose.lopez@example.com +uljysdvdlcyrbrwk,William Rose,30,william.rose@example.com +ot8xtzh77j55wq0s,Sarah Ford,26,sarah.ford@example.com +9t76vnsv2u36s43t,Alisha Jones,61,alisha.jones@example.com +66y4tnty62hw8c02,Kristin Kelly,61,kristin.kelly@example.com +2punfblazi5v16ar,Brendan Stout,40,brendan.stout@example.com +sxhr4nf5w2gx4wbg,Kelly Cruz,18,kelly.cruz@example.com +68dvrqfwqnkq5el9,Samantha Martin,50,samantha.martin@example.com +20192l6dbeinhkh0,David Santos,46,david.santos@example.com +si0l4dgay09ebfmf,Elizabeth Carroll,22,elizabeth.carroll@example.com +lhse40vbldqb6ap1,Corey Owens,46,corey.owens@example.com +h5t3pslykyx3kxfm,Shelby Mueller,65,shelby.mueller@example.com +ldc0luydrw6jub0f,Dr. Sylvia Myers,29,sylvia.myers@example.com +voc9628xg4dsgw2y,Scott Freeman,48,scott.freeman@example.com +o4y0gk3gqv1ax2fz,Christopher Atkinson,21,christopher.atkinson@example.com +u1n3x4e4u7e0vzj6,Sean Diaz,31,sean.diaz@example.com +s36eskwtm0w7lwr7,Bobby Dyer,57,bobby.dyer@example.com +4hjnag1p5iwvtixd,Daniel Hall,62,daniel.hall@example.com +m91d80oxsa216zbh,Jennifer Ramirez,65,jennifer.ramirez@example.com +5hj6858zo2g85n6v,Angela Jackson,57,angela.jackson@example.com +8m8oihv9a1e7nn92,Kelly Lewis,36,kelly.lewis@example.com +7azy39la0no0mxi7,Jessica Munoz,55,jessica.munoz@example.com +47pmjkhnnqhyit8c,Kelly George,65,kelly.george@example.com +6j6cpy4kgneg1mmh,Anthony Johnson,65,anthony.johnson@example.com +tnlmtvap1zz89km9,Regina Fields,61,regina.fields@example.com +6cyuvnwwqdmrpfzh,Sharon Schaefer,30,sharon.schaefer@example.com +p1v4pyu2pqodc0ey,Jacob French,62,jacob.french@example.com +6npynnhjt2jd05xo,Jessica Costa,23,jessica.costa@example.com +wcxedf13n2e9qi4l,George Hardy,53,george.hardy@example.com +yf2xlcmszk2tqeig,Andrea Allison,20,andrea.allison@example.com +3bf2zzv7poststwa,Kevin Ferguson,32,kevin.ferguson@example.com +c2iataz0hhv39q63,Joseph Johnson,58,joseph.johnson@example.com +3e8npxhov4a39pvq,Ashley Martinez,18,ashley.martinez@example.com +t7dp41tysipytywq,Charles Nixon,23,charles.nixon@example.com +z8cztq7c47phyfhk,Carol Dudley,40,carol.dudley@example.com +2636f9d8r4ipm3h6,David Weber,51,david.weber@example.com +eh3f6wxtvkjq6ykq,Scott Robinson,32,scott.robinson@example.com +raskbwpsje69a59h,Anthony Hardy,38,anthony.hardy@example.com +90hn1p0b4cs9e2og,Mackenzie Owens,52,mackenzie.owens@example.com +am3swwfbo076x0v1,Brian Foster,27,brian.foster@example.com +5uw7utb9lq5cfncw,Hannah Forbes,56,hannah.forbes@example.com +cs6mbfzkzifefx6r,Lauren Reed,26,lauren.reed@example.com +ftw3uvztziiz9x00,Morgan Smith,28,morgan.smith@example.com +uhrqseeo43mozpaq,Samantha Alexander,65,samantha.alexander@example.com +pvvmzyfc1lxor11e,Tiffany Roberts,20,tiffany.roberts@example.com +jia7bdag4abz123s,Emily Hayes,34,emily.hayes@example.com +h6oozcngbz8o5x4y,Rebecca Villegas,52,rebecca.villegas@example.com +9v6z1pn2f9twcy12,Donald Shah,61,donald.shah@example.com +wzz3jduioso77o7f,Denise Cain,59,denise.cain@example.com +u51plhgvjodkswnr,Kristine Ramirez,53,kristine.ramirez@example.com +t1uhkmiytfyc13vc,Stacey Adkins,61,stacey.adkins@example.com +iqaqnf0ybg2ct507,Daniel Hunt,20,daniel.hunt@example.com +idwrwv2uu4hcpv2i,Roberta Johnson,48,roberta.johnson@example.com +2yd2hd6auetjacyo,Jason Williamson,39,jason.williamson@example.com +egrmdbibnjhi914x,Sandra Robinson,50,sandra.robinson@example.com +15m1pz2bb0ercgyk,Steve Rice,25,steve.rice@example.com +0i21bhkxdagjurb7,Kimberly Fritz,53,kimberly.fritz@example.com +726ofi7h5snreq67,Brianna Reynolds,33,brianna.reynolds@example.com +csqxse3wym56eim6,Alexander Williams,50,alexander.williams@example.com +qeaoylnrsf8p3byg,Andrew Thomas,25,andrew.thomas@example.com +edsswobumzyzbvhf,Austin Williams,57,austin.williams@example.com +hdzhzpt0ahy5hkib,Nicholas Williams,24,nicholas.williams@example.com +w1qmvmg4roa8xnwu,Mrs. Michelle Cisneros,48,michelle.cisneros@example.com +3z3o73x7adyuo6w0,Stacey Smith,39,stacey.smith@example.com +sse2u5zlgoqrgmcf,Laura Beck,20,laura.beck@example.com +rvovijmvch58r4yx,Molly Clark,51,molly.clark@example.com +doe06nrx8sg5mcuv,Carmen Morris,41,carmen.morris@example.com +jbjdwuvj5s4kw04y,Amanda Munoz,20,amanda.munoz@example.com +6k2ewkla7js0yw23,Rachel Collins,44,rachel.collins@example.com +fcxuyr4kkhrnigu1,John Alexander,18,john.alexander@example.com +d25fuwlos5mk07o0,Stacy Hunter,22,stacy.hunter@example.com +1vdai2rxmwd57oet,Eric Massey,40,eric.massey@example.com +pq4jnt9izu1wlrzd,Scott Garcia,20,scott.garcia@example.com +lz9kfc0lty5xcz14,Cassandra Nelson,35,cassandra.nelson@example.com +pu7w6tyab5jd4we9,Aaron Johnson,50,aaron.johnson@example.com +8dupswd2kqwdyn8v,Shannon Sherman,45,shannon.sherman@example.com +ye466l71jthiz2p6,April Garcia,60,april.garcia@example.com +xogsmfwb73l16qdt,Evan Lynn,20,evan.lynn@example.com diff --git a/tests/resources/csv/missing-column.csv b/tests/resources/csv/missing-column.csv new file mode 100644 index 0000000000..e57b5ccb2e --- /dev/null +++ b/tests/resources/csv/missing-column.csv @@ -0,0 +1,101 @@ +$id,name +hxfcwpcas5xokpwe,Diamond Mendez +gw8nxwf6esn3tfwf,Michael Huff +xb6bxg56lral1qy9,Alyssa Rodriguez +imerjq5j36y3agh2,Barbara Smith +07yq9qdlhmbzmr35,Evelyn Edwards +ksqo631sbhwj5ltg,Tina Richardson +j7zlndgu0gbshp15,Joel Hernandez +mfntvnljrcmf7h6v,Zachary Cooper +5f9b01nziqu2h8ed,Brittany Spears +4vxzbnzraqznk5u8,Holly White +d4ywy3mtphaatbpf,Kimberly Barnes +88odnk6nthyyvbal,Stephen Miller +08oekee3fn7mzaa5,Yvonne Newman +quw55kn9895i5e4v,Carol Kane +nge6bm8ykripei6f,Doris Foster +4k16i33s0xl2ypx9,Joseph Stokes +q0j5rxbgid66snyf,Steve Williams +n1oxun7mqq3p103y,James Carey +0dbvs840jkf8i0ye,Kathryn Henry +5sfaidgs1h87v15v,Christopher Landry +vg3punvfu5khmf41,Jennifer Mcgee +f933qydr9u5b2r11,Cathy Church +wjv87y1inf8yk32s,Jose Lopez +uljysdvdlcyrbrwk,William Rose +ot8xtzh77j55wq0s,Sarah Ford +9t76vnsv2u36s43t,Alisha Jones +66y4tnty62hw8c02,Kristin Kelly +2punfblazi5v16ar,Brendan Stout +sxhr4nf5w2gx4wbg,Kelly Cruz +68dvrqfwqnkq5el9,Samantha Martin +20192l6dbeinhkh0,David Santos +si0l4dgay09ebfmf,Elizabeth Carroll +lhse40vbldqb6ap1,Corey Owens +h5t3pslykyx3kxfm,Shelby Mueller +ldc0luydrw6jub0f,Dr. Sylvia Myers +voc9628xg4dsgw2y,Scott Freeman +o4y0gk3gqv1ax2fz,Christopher Atkinson +u1n3x4e4u7e0vzj6,Sean Diaz +s36eskwtm0w7lwr7,Bobby Dyer +4hjnag1p5iwvtixd,Daniel Hall +m91d80oxsa216zbh,Jennifer Ramirez +5hj6858zo2g85n6v,Angela Jackson +8m8oihv9a1e7nn92,Kelly Lewis +7azy39la0no0mxi7,Jessica Munoz +47pmjkhnnqhyit8c,Kelly George +6j6cpy4kgneg1mmh,Anthony Johnson +tnlmtvap1zz89km9,Regina Fields +6cyuvnwwqdmrpfzh,Sharon Schaefer +p1v4pyu2pqodc0ey,Jacob French +6npynnhjt2jd05xo,Jessica Costa +wcxedf13n2e9qi4l,George Hardy +yf2xlcmszk2tqeig,Andrea Allison +3bf2zzv7poststwa,Kevin Ferguson +c2iataz0hhv39q63,Joseph Johnson +3e8npxhov4a39pvq,Ashley Martinez +t7dp41tysipytywq,Charles Nixon +z8cztq7c47phyfhk,Carol Dudley +2636f9d8r4ipm3h6,David Weber +eh3f6wxtvkjq6ykq,Scott Robinson +raskbwpsje69a59h,Anthony Hardy +90hn1p0b4cs9e2og,Mackenzie Owens +am3swwfbo076x0v1,Brian Foster +5uw7utb9lq5cfncw,Hannah Forbes +cs6mbfzkzifefx6r,Lauren Reed +ftw3uvztziiz9x00,Morgan Smith +uhrqseeo43mozpaq,Samantha Alexander +pvvmzyfc1lxor11e,Tiffany Roberts +jia7bdag4abz123s,Emily Hayes +h6oozcngbz8o5x4y,Rebecca Villegas +9v6z1pn2f9twcy12,Donald Shah +wzz3jduioso77o7f,Denise Cain +u51plhgvjodkswnr,Kristine Ramirez +t1uhkmiytfyc13vc,Stacey Adkins +iqaqnf0ybg2ct507,Daniel Hunt +idwrwv2uu4hcpv2i,Roberta Johnson +2yd2hd6auetjacyo,Jason Williamson +egrmdbibnjhi914x,Sandra Robinson +15m1pz2bb0ercgyk,Steve Rice +0i21bhkxdagjurb7,Kimberly Fritz +726ofi7h5snreq67,Brianna Reynolds +csqxse3wym56eim6,Alexander Williams +qeaoylnrsf8p3byg,Andrew Thomas +edsswobumzyzbvhf,Austin Williams +hdzhzpt0ahy5hkib,Nicholas Williams +w1qmvmg4roa8xnwu,Mrs. Michelle Cisneros +3z3o73x7adyuo6w0,Stacey Smith +sse2u5zlgoqrgmcf,Laura Beck +rvovijmvch58r4yx,Molly Clark +doe06nrx8sg5mcuv,Carmen Morris +jbjdwuvj5s4kw04y,Amanda Munoz +6k2ewkla7js0yw23,Rachel Collins +fcxuyr4kkhrnigu1,John Alexander +d25fuwlos5mk07o0,Stacy Hunter +1vdai2rxmwd57oet,Eric Massey +pq4jnt9izu1wlrzd,Scott Garcia +lz9kfc0lty5xcz14,Cassandra Nelson +pu7w6tyab5jd4we9,Aaron Johnson +8dupswd2kqwdyn8v,Shannon Sherman +ye466l71jthiz2p6,April Garcia +xogsmfwb73l16qdt,Evan Lynn diff --git a/tests/resources/csv/missing-row.csv b/tests/resources/csv/missing-row.csv new file mode 100644 index 0000000000..7399fa9f51 --- /dev/null +++ b/tests/resources/csv/missing-row.csv @@ -0,0 +1,101 @@ +$id,name,age +hxfcwpcas5xokpwe,Diamond Mendez +gw8nxwf6esn3tfwf,Michael Huff +xb6bxg56lral1qy9,Alyssa Rodriguez +imerjq5j36y3agh2,Barbara Smith +07yq9qdlhmbzmr35,Evelyn Edwards +ksqo631sbhwj5ltg,Tina Richardson +j7zlndgu0gbshp15,Joel Hernandez +mfntvnljrcmf7h6v,Zachary Cooper +5f9b01nziqu2h8ed,Brittany Spears +4vxzbnzraqznk5u8,Holly White +d4ywy3mtphaatbpf,Kimberly Barnes +88odnk6nthyyvbal,Stephen Miller +08oekee3fn7mzaa5,Yvonne Newman +quw55kn9895i5e4v,Carol Kane +nge6bm8ykripei6f,Doris Foster +4k16i33s0xl2ypx9,Joseph Stokes +q0j5rxbgid66snyf,Steve Williams +n1oxun7mqq3p103y,James Carey +0dbvs840jkf8i0ye,Kathryn Henry +5sfaidgs1h87v15v,Christopher Landry +vg3punvfu5khmf41,Jennifer Mcgee +f933qydr9u5b2r11,Cathy Church +wjv87y1inf8yk32s,Jose Lopez +uljysdvdlcyrbrwk,William Rose +ot8xtzh77j55wq0s,Sarah Ford +9t76vnsv2u36s43t,Alisha Jones +66y4tnty62hw8c02,Kristin Kelly +2punfblazi5v16ar,Brendan Stout +sxhr4nf5w2gx4wbg,Kelly Cruz +68dvrqfwqnkq5el9,Samantha Martin +20192l6dbeinhkh0,David Santos +si0l4dgay09ebfmf,Elizabeth Carroll +lhse40vbldqb6ap1,Corey Owens +h5t3pslykyx3kxfm,Shelby Mueller +ldc0luydrw6jub0f,Dr. Sylvia Myers +voc9628xg4dsgw2y,Scott Freeman +o4y0gk3gqv1ax2fz,Christopher Atkinson +u1n3x4e4u7e0vzj6,Sean Diaz +s36eskwtm0w7lwr7,Bobby Dyer +4hjnag1p5iwvtixd,Daniel Hall +m91d80oxsa216zbh,Jennifer Ramirez +5hj6858zo2g85n6v,Angela Jackson +8m8oihv9a1e7nn92,Kelly Lewis +7azy39la0no0mxi7,Jessica Munoz +47pmjkhnnqhyit8c,Kelly George +6j6cpy4kgneg1mmh,Anthony Johnson +tnlmtvap1zz89km9,Regina Fields +6cyuvnwwqdmrpfzh,Sharon Schaefer +p1v4pyu2pqodc0ey,Jacob French +6npynnhjt2jd05xo,Jessica Costa +wcxedf13n2e9qi4l,George Hardy +yf2xlcmszk2tqeig,Andrea Allison +3bf2zzv7poststwa,Kevin Ferguson +c2iataz0hhv39q63,Joseph Johnson +3e8npxhov4a39pvq,Ashley Martinez +t7dp41tysipytywq,Charles Nixon +z8cztq7c47phyfhk,Carol Dudley +2636f9d8r4ipm3h6,David Weber +eh3f6wxtvkjq6ykq,Scott Robinson +raskbwpsje69a59h,Anthony Hardy +90hn1p0b4cs9e2og,Mackenzie Owens +am3swwfbo076x0v1,Brian Foster +5uw7utb9lq5cfncw,Hannah Forbes +cs6mbfzkzifefx6r,Lauren Reed +ftw3uvztziiz9x00,Morgan Smith +uhrqseeo43mozpaq,Samantha Alexander +pvvmzyfc1lxor11e,Tiffany Roberts +jia7bdag4abz123s,Emily Hayes +h6oozcngbz8o5x4y,Rebecca Villegas +9v6z1pn2f9twcy12,Donald Shah +wzz3jduioso77o7f,Denise Cain +u51plhgvjodkswnr,Kristine Ramirez +t1uhkmiytfyc13vc,Stacey Adkins +iqaqnf0ybg2ct507,Daniel Hunt +idwrwv2uu4hcpv2i,Roberta Johnson +2yd2hd6auetjacyo,Jason Williamson +egrmdbibnjhi914x,Sandra Robinson +15m1pz2bb0ercgyk,Steve Rice +0i21bhkxdagjurb7,Kimberly Fritz +726ofi7h5snreq67,Brianna Reynolds +csqxse3wym56eim6,Alexander Williams +qeaoylnrsf8p3byg,Andrew Thomas +edsswobumzyzbvhf,Austin Williams +hdzhzpt0ahy5hkib,Nicholas Williams +w1qmvmg4roa8xnwu,Mrs. Michelle Cisneros +3z3o73x7adyuo6w0,Stacey Smith +sse2u5zlgoqrgmcf,Laura Beck +rvovijmvch58r4yx,Molly Clark +doe06nrx8sg5mcuv,Carmen Morris +jbjdwuvj5s4kw04y,Amanda Munoz +6k2ewkla7js0yw23,Rachel Collins +fcxuyr4kkhrnigu1,John Alexander +d25fuwlos5mk07o0,Stacy Hunter +1vdai2rxmwd57oet,Eric Massey +pq4jnt9izu1wlrzd,Scott Garcia +lz9kfc0lty5xcz14,Cassandra Nelson +pu7w6tyab5jd4we9,Aaron Johnson +8dupswd2kqwdyn8v,Shannon Sherman +ye466l71jthiz2p6,April Garcia +xogsmfwb73l16qdt,Evan Lynn diff --git a/tests/resources/docker/docker-compose.yml b/tests/resources/docker/docker-compose.yml index e549ac27a5..4bbca3e9c0 100644 --- a/tests/resources/docker/docker-compose.yml +++ b/tests/resources/docker/docker-compose.yml @@ -67,7 +67,7 @@ services: - _APP_OPTIONS_ABUSE - _APP_OPTIONS_ROUTER_PROTECTION - _APP_OPTIONS_FORCE_HTTPS - - _APP_OPTIONS_FUNCTIONS_FORCE_HTTPS + - _APP_OPTIONS_ROUTER_FORCE_HTTPS - _APP_OPENSSL_KEY_V1 - _APP_DOMAIN - _APP_DOMAIN_FUNCTIONS @@ -83,10 +83,9 @@ services: - _APP_STORAGE_ANTIVIRUS=disabled - _APP_STORAGE_LIMIT - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_CONTAINERS - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY - - _APP_FUNCTIONS_MEMORY_SWAP + - _APP_SITES_TIMEOUT + - _APP_COMPUTE_CPUS + - _APP_COMPUTE_MEMORY - _APP_EXECUTOR_HOST appwrite-worker-stats-usage: @@ -241,10 +240,9 @@ services: - _APP_DB_USER - _APP_DB_PASS - _APP_FUNCTIONS_TIMEOUT - - _APP_FUNCTIONS_CONTAINERS - - _APP_FUNCTIONS_CPUS - - _APP_FUNCTIONS_MEMORY - - _APP_FUNCTIONS_MEMORY_SWAP + - _APP_SITES_TIMEOUT + - _APP_COMPUTE_CPUS + - _APP_COMPUTE_MEMORY - _APP_EXECUTOR_HOST appwrite-worker-mails: diff --git a/tests/resources/functions/node/maintenance.js b/tests/resources/functions/node/maintenance.js new file mode 100644 index 0000000000..0885f11041 --- /dev/null +++ b/tests/resources/functions/node/maintenance.js @@ -0,0 +1,3 @@ +module.exports = async(context) => { + return context.res.send('Maintenance'); +} \ No newline at end of file diff --git a/tests/resources/functions/php/index.php b/tests/resources/functions/php/index.php index 27a9418b3c..6c67f27ee1 100644 --- a/tests/resources/functions/php/index.php +++ b/tests/resources/functions/php/index.php @@ -1,6 +1,12 @@ <?php return function ($context) { + if ($context->req->path === '/custom-response') { + $code = (int) ($context->req->query['code'] ?? '200'); + $body = $context->req->query['body'] ?? ''; + return $context->res->send($body, $code); + } + $context->log('body-is-' . ($context->req->body ?? '')); $context->log('custom-header-is-' . ($context->req->headers['x-custom-header'] ?? '')); $context->log('method-is-' . \strtolower($context->req->method ?? '')); diff --git a/tests/resources/qr/qr-default.png b/tests/resources/qr/qr-default.png index 58af53bb93..467be60e07 100644 Binary files a/tests/resources/qr/qr-default.png and b/tests/resources/qr/qr-default.png differ diff --git a/tests/resources/qr/qr-size-200-margin-10.png b/tests/resources/qr/qr-size-200-margin-10.png index b40529396e..ed98698390 100644 Binary files a/tests/resources/qr/qr-size-200-margin-10.png and b/tests/resources/qr/qr-size-200-margin-10.png differ diff --git a/tests/resources/qr/qr-size-200.png b/tests/resources/qr/qr-size-200.png index a44e4861e3..f7418d548f 100644 Binary files a/tests/resources/qr/qr-size-200.png and b/tests/resources/qr/qr-size-200.png differ diff --git a/tests/resources/sites/astro-static/astro.config.mjs b/tests/resources/sites/astro-static/astro.config.mjs new file mode 100644 index 0000000000..20b0b8e2ba --- /dev/null +++ b/tests/resources/sites/astro-static/astro.config.mjs @@ -0,0 +1,4 @@ +import { defineConfig } from 'astro/config'; + +export default defineConfig({ +}); diff --git a/tests/resources/sites/astro-static/package.json b/tests/resources/sites/astro-static/package.json new file mode 100644 index 0000000000..147dcf1f07 --- /dev/null +++ b/tests/resources/sites/astro-static/package.json @@ -0,0 +1,14 @@ +{ + "name": "my-astro-app", + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro" + }, + "dependencies": { + "astro": "^5.2.5" + } +} diff --git a/tests/resources/sites/astro-static/src/pages/index.astro b/tests/resources/sites/astro-static/src/pages/index.astro new file mode 100644 index 0000000000..0b4f43c3d6 --- /dev/null +++ b/tests/resources/sites/astro-static/src/pages/index.astro @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>Astro static + + + + diff --git a/tests/resources/sites/astro/astro.config.mjs b/tests/resources/sites/astro/astro.config.mjs new file mode 100644 index 0000000000..a87942461e --- /dev/null +++ b/tests/resources/sites/astro/astro.config.mjs @@ -0,0 +1,9 @@ +import { defineConfig } from 'astro/config'; +import node from '@astrojs/node'; + +export default defineConfig({ + output: 'server', + adapter: node({ + mode: 'standalone' + }), +}); diff --git a/tests/resources/sites/astro/package.json b/tests/resources/sites/astro/package.json new file mode 100644 index 0000000000..8cbcb910f5 --- /dev/null +++ b/tests/resources/sites/astro/package.json @@ -0,0 +1,15 @@ +{ + "name": "my-astro-app", + "type": "module", + "version": "0.0.1", + "scripts": { + "dev": "astro dev", + "build": "astro build", + "preview": "astro preview", + "astro": "astro" + }, + "dependencies": { + "@astrojs/node": "^9.0.2", + "astro": "^5.2.5" + } +} diff --git a/tests/resources/sites/astro/src/pages/index.astro b/tests/resources/sites/astro/src/pages/index.astro new file mode 100644 index 0000000000..cc8fd9411f --- /dev/null +++ b/tests/resources/sites/astro/src/pages/index.astro @@ -0,0 +1,15 @@ +--- +const value = import.meta.env.name || 'Variable not found'; +--- + + + + + + + Astro SSR + + +

Env variable is {value}

+ + diff --git a/tests/resources/sites/astro/src/pages/logs-action.js b/tests/resources/sites/astro/src/pages/logs-action.js new file mode 100644 index 0000000000..348297a616 --- /dev/null +++ b/tests/resources/sites/astro/src/pages/logs-action.js @@ -0,0 +1,7 @@ +export async function GET(context) { + console.log("Log1"); + console.error("Error1"); + console.log("Log2"); + console.error("Error2"); + return new Response('Action logs printed.'); +} diff --git a/tests/resources/sites/astro/src/pages/logs-inline.astro b/tests/resources/sites/astro/src/pages/logs-inline.astro new file mode 100644 index 0000000000..c539142d83 --- /dev/null +++ b/tests/resources/sites/astro/src/pages/logs-inline.astro @@ -0,0 +1,18 @@ +--- +console.log("Log1"); +console.error("Error1"); +console.log("Log2"); +console.error("Error2"); +--- + + + + + + + Astro Logs + + +

Inline logs printed.

+ + diff --git a/tests/resources/sites/static-single-file/main.html b/tests/resources/sites/static-single-file/main.html new file mode 100644 index 0000000000..2615f0c820 --- /dev/null +++ b/tests/resources/sites/static-single-file/main.html @@ -0,0 +1,10 @@ + + + + + + Main page + + + + \ No newline at end of file diff --git a/tests/resources/sites/static-spa/404.html b/tests/resources/sites/static-spa/404.html new file mode 100644 index 0000000000..2a51f36d22 --- /dev/null +++ b/tests/resources/sites/static-spa/404.html @@ -0,0 +1,10 @@ + + + + + + + +

Customized 404 page

+ + diff --git a/tests/resources/sites/static-spa/contact.html b/tests/resources/sites/static-spa/contact.html new file mode 100644 index 0000000000..1ef7dc9497 --- /dev/null +++ b/tests/resources/sites/static-spa/contact.html @@ -0,0 +1,10 @@ + + + + + + + +

Contact page

+ + diff --git a/tests/resources/sites/static-spa/index.html b/tests/resources/sites/static-spa/index.html new file mode 100644 index 0000000000..3fd2262803 --- /dev/null +++ b/tests/resources/sites/static-spa/index.html @@ -0,0 +1,10 @@ + + + + + + + +

Index page

+ + diff --git a/tests/resources/sites/static-themed/index.html b/tests/resources/sites/static-themed/index.html new file mode 100644 index 0000000000..955696b473 --- /dev/null +++ b/tests/resources/sites/static-themed/index.html @@ -0,0 +1,23 @@ + + + + + + Themed website + + + + diff --git a/tests/resources/sites/static/contact.html b/tests/resources/sites/static/contact.html new file mode 100644 index 0000000000..b2c16fc471 --- /dev/null +++ b/tests/resources/sites/static/contact.html @@ -0,0 +1,11 @@ + + + + + + Contact page + + +

Contact page

+ + \ No newline at end of file diff --git a/tests/resources/sites/static/index.html b/tests/resources/sites/static/index.html new file mode 100644 index 0000000000..ca1b1cc78d --- /dev/null +++ b/tests/resources/sites/static/index.html @@ -0,0 +1,11 @@ + + + + + + Hello Appwrite + + +

Hello Appwrite

+ + \ No newline at end of file diff --git a/tests/resources/sites/sub-directories/index.html b/tests/resources/sites/sub-directories/index.html new file mode 100644 index 0000000000..d21a10191c --- /dev/null +++ b/tests/resources/sites/sub-directories/index.html @@ -0,0 +1,5 @@ + + +

Sub-directory index

+ + diff --git a/tests/resources/sites/sub-directories/project1/index.html b/tests/resources/sites/sub-directories/project1/index.html new file mode 100644 index 0000000000..8fc477991c --- /dev/null +++ b/tests/resources/sites/sub-directories/project1/index.html @@ -0,0 +1,5 @@ + + +

Sub-directory project1

+ + \ No newline at end of file diff --git a/tests/unit/Network/Validators/CNAMETest.php b/tests/unit/Network/Validators/CNAMETest.php deleted file mode 100644 index cbb07f19b5..0000000000 --- a/tests/unit/Network/Validators/CNAMETest.php +++ /dev/null @@ -1,29 +0,0 @@ -object = new CNAME('appwrite.io'); - } - - public function tearDown(): void - { - } - - public function testValues(): void - { - $this->assertEquals($this->object->isValid(''), false); - $this->assertEquals($this->object->isValid(null), false); - $this->assertEquals($this->object->isValid(false), false); - $this->assertEquals($this->object->isValid('cname-unit-test.appwrite.org'), true); - $this->assertEquals($this->object->isValid('test1.appwrite.org'), false); - } -} diff --git a/tests/unit/Network/Validators/DNSTest.php b/tests/unit/Network/Validators/DNSTest.php new file mode 100644 index 0000000000..5e8652381a --- /dev/null +++ b/tests/unit/Network/Validators/DNSTest.php @@ -0,0 +1,50 @@ +assertEquals($validator->isValid(''), false); + $this->assertEquals($validator->isValid(null), false); + $this->assertEquals($validator->isValid(false), false); + $this->assertEquals($validator->isValid('cname-unit-test.appwrite.org'), true); + $this->assertEquals($validator->isValid('test1.appwrite.org'), false); + } + + public function testA(): void + { + // IPv4 for documentation purposes + $validator = new DNS('203.0.113.1', DNS::RECORD_A); + $this->assertEquals($validator->isValid(''), false); + $this->assertEquals($validator->isValid(null), false); + $this->assertEquals($validator->isValid(false), false); + $this->assertEquals($validator->isValid('a-unit-test.appwrite.org'), true); + $this->assertEquals($validator->isValid('test1.appwrite.org'), false); + } + + public function testAAAA(): void + { + // IPv6 for documentation purposes + $validator = new DNS('2001:db8::1', DNS::RECORD_AAAA); + $this->assertEquals($validator->isValid(''), false); + $this->assertEquals($validator->isValid(null), false); + $this->assertEquals($validator->isValid(false), false); + $this->assertEquals($validator->isValid('aaaa-unit-test.appwrite.org'), true); + $this->assertEquals($validator->isValid('test1.appwrite.org'), false); + } +} diff --git a/tests/unit/Transformation/TransformationTest.php b/tests/unit/Transformation/TransformationTest.php new file mode 100644 index 0000000000..a3169026a3 --- /dev/null +++ b/tests/unit/Transformation/TransformationTest.php @@ -0,0 +1,43 @@ +addAdapter(new Mock()); + + $transformer->setInput($input); + $transformer->setTraits([]); + + $this->assertFalse($transformer->transform()); + + $transformer->setTraits(['mock' => true]); + $this->assertFalse($transformer->transform()); + + $transformer->setTraits(['mock' => true, 'content-type' => 'text/plain']); + $this->assertFalse($transformer->transform()); + + $transformer->setTraits(['mock' => true, 'content-type' => 'tExT/HtML']); + $this->assertFalse($transformer->transform()); + + $transformer->setTraits(['mock' => false, 'content-type' => 'text/plain, text/html; charset=utf-8']); + $this->assertFalse($transformer->transform()); + + $transformer->setTraits(['mock' => true, 'content-type' => 'text/plain, text/html; charset=utf-8']); + $this->assertTrue($transformer->transform()); + + $this->assertStringContainsString("Hello world", $transformer->getOutput()); + $this->assertStringContainsString("Preview by", $transformer->getOutput()); + $this->assertStringContainsString("Mock:", $transformer->getOutput()); + } +} diff --git a/tests/unit/Utopia/Request/Filters/V19Test.php b/tests/unit/Utopia/Request/Filters/V19Test.php new file mode 100644 index 0000000000..418951705e --- /dev/null +++ b/tests/unit/Utopia/Request/Filters/V19Test.php @@ -0,0 +1,85 @@ +filter = new V19(); + } + + public function tearDown(): void + { + } + + public function functionsCreateProvider() + { + return [ + 'remove template fields' => [ + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0', + 'templateRepository' => 'github.com/appwrite/templates', + 'templateOwner' => 'appwrite', + 'templateRootDirectory' => 'functions/node', + 'templateVersion' => '1.0.0' + ], + [ + 'name' => 'test-function', + 'runtime' => 'node-18.0' + ] + ] + ]; + } + + public function functionsListExecutionsProvider() + { + return [ + 'remove search field' => [ + [ + 'functionId' => 'test-function', + 'search' => 'test query', + 'limit' => 10 + ], + [ + 'functionId' => 'test-function', + 'limit' => 10 + ] + ] + ]; + } + + /** + * @dataProvider functionsCreateProvider + */ + public function testFunctionsCreate(array $content, array $expected): void + { + $model = 'functions.create'; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + /** + * @dataProvider functionsListExecutionsProvider + */ + public function testFunctionsListExecutions(array $content, array $expected): void + { + $model = 'functions.listExecutions'; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } +} diff --git a/tests/unit/Utopia/Response/Filters/V19Test.php b/tests/unit/Utopia/Response/Filters/V19Test.php new file mode 100644 index 0000000000..7d413bdd37 --- /dev/null +++ b/tests/unit/Utopia/Response/Filters/V19Test.php @@ -0,0 +1,447 @@ +filter = new V19(); + } + + public function tearDown(): void + { + } + + public function functionProvider(): array + { + return [ + 'change deploymentId to deployment' => [ + [ + 'deploymentId' => 'deployment123', + ], + [ + 'deployment' => 'deployment123', + ] + ], + 'handle empty deploymentId' => [ + [ + 'name' => 'test-function', + ], + [ + 'deployment' => '', + 'name' => 'test-function', + ] + ], + ]; + } + + /** + * @dataProvider functionProvider + */ + public function testFunction(array $content, array $expected): void + { + $model = Response::MODEL_FUNCTION; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function functionListProvider(): array + { + return [ + 'convert list of functions' => [ + [ + 'total' => 2, + 'functions' => [ + [ + 'deploymentId' => 'deployment123', + 'name' => 'function-1', + ], + [ + 'deploymentId' => 'deployment456', + 'name' => 'function-2', + ], + ], + ], + [ + 'total' => 2, + 'functions' => [ + [ + 'deployment' => 'deployment123', + 'name' => 'function-1', + ], + [ + 'deployment' => 'deployment456', + 'name' => 'function-2', + ], + ], + ] + ], + 'handle empty function list' => [ + [ + 'total' => 0, + 'functions' => [], + ], + [ + 'total' => 0, + 'functions' => [], + ] + ], + ]; + } + + /** + * @dataProvider functionListProvider + */ + public function testFunctionList(array $content, array $expected): void + { + $model = Response::MODEL_FUNCTION_LIST; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function deploymentProvider(): array + { + return [ + 'rename sourceSize to size and buildDuration to buildTime' => [ + [ + 'sourceSize' => 1024, + 'buildDuration' => 60, + 'id' => 'deployment123', + ], + [ + 'size' => 1024, + 'buildTime' => 60, + 'id' => 'deployment123', + ] + ], + 'handle missing sourceSize and buildDuration' => [ + [ + 'id' => 'deployment123', + ], + [ + 'size' => '', + 'buildTime' => '', + 'id' => 'deployment123', + ] + ], + ]; + } + + /** + * @dataProvider deploymentProvider + */ + public function testDeployment(array $content, array $expected): void + { + $model = Response::MODEL_DEPLOYMENT; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function proxyRuleProvider(): array + { + return [ + 'rename deployment resource fields' => [ + [ + 'deploymentResourceType' => 'function', + 'deploymentResourceId' => 'func123', + 'domain' => 'example.com', + ], + [ + 'resourceType' => 'function', + 'resourceId' => 'func123', + 'domain' => 'example.com', + ] + ], + 'handle missing deployment resource fields' => [ + [ + 'domain' => 'example.com', + ], + [ + 'resourceType' => '', + 'resourceId' => '', + 'domain' => 'example.com', + ] + ], + ]; + } + + /** + * @dataProvider proxyRuleProvider + */ + public function testProxyRule(array $content, array $expected): void + { + $model = Response::MODEL_PROXY_RULE; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function migrationProvider(): array + { + return [ + 'remove resourceId field' => [ + [ + 'resourceId' => 'resource123', + 'status' => 'completed', + ], + [ + 'status' => 'completed', + ] + ], + 'handle content without resourceId' => [ + [ + 'status' => 'completed', + ], + [ + 'status' => 'completed', + ] + ], + ]; + } + + /** + * @dataProvider migrationProvider + */ + public function testMigration(array $content, array $expected): void + { + $model = Response::MODEL_MIGRATION; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function projectProvider(): array + { + return [ + 'remove devKeys field' => [ + [ + 'devKeys' => ['key1', 'key2'], + 'name' => 'test-project', + ], + [ + 'name' => 'test-project', + ] + ], + 'handle content without devKeys' => [ + [ + 'name' => 'test-project', + ], + [ + 'name' => 'test-project', + ] + ], + ]; + } + + /** + * @dataProvider projectProvider + */ + public function testProject(array $content, array $expected): void + { + $model = Response::MODEL_PROJECT; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function providerRepositoryProvider(): array + { + return [ + 'remove runtime field' => [ + [ + 'runtime' => 'nodejs', + 'name' => 'test-repo', + ], + [ + 'name' => 'test-repo', + ] + ], + 'handle content without runtime' => [ + [ + 'name' => 'test-repo', + ], + [ + 'name' => 'test-repo', + ] + ], + ]; + } + + /** + * @dataProvider providerRepositoryProvider + */ + public function testProviderRepository(array $content, array $expected): void + { + $model = Response::MODEL_PROVIDER_REPOSITORY; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function templateVariableProvider(): array + { + return [ + 'remove secret field' => [ + [ + 'secret' => 'secret-value', + 'name' => 'test-variable', + ], + [ + 'name' => 'test-variable', + ] + ], + 'handle content without secret' => [ + [ + 'name' => 'test-variable', + ], + [ + 'name' => 'test-variable', + ] + ], + ]; + } + + /** + * @dataProvider templateVariableProvider + */ + public function testTemplateVariable(array $content, array $expected): void + { + $model = Response::MODEL_TEMPLATE_VARIABLE; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function usageFunctionProvider(): array + { + return [ + 'remove build-related fields' => [ + [ + 'buildsSuccessTotal' => 10, + 'buildsFailedTotal' => 2, + 'buildsTimeAverage' => 30, + 'buildsSuccess' => 5, + 'buildsFailed' => 1, + 'executions' => 100, + ], + [ + 'executions' => 100, + ] + ], + 'handle content without build fields' => [ + [ + 'executions' => 100, + ], + [ + 'executions' => 100, + ] + ], + ]; + } + + /** + * @dataProvider usageFunctionProvider + */ + public function testUsageFunction(array $content, array $expected): void + { + $model = Response::MODEL_USAGE_FUNCTION; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function usageFunctionsProvider(): array + { + return [ + 'remove build-related fields' => [ + [ + 'buildsSuccessTotal' => 20, + 'buildsFailedTotal' => 4, + 'buildsSuccess' => 10, + 'buildsFailed' => 2, + 'executions' => 200, + ], + [ + 'executions' => 200, + ] + ], + 'handle content without build fields' => [ + [ + 'executions' => 200, + ], + [ + 'executions' => 200, + ] + ], + ]; + } + + /** + * @dataProvider usageFunctionsProvider + */ + public function testUsageFunctions(array $content, array $expected): void + { + $model = Response::MODEL_USAGE_FUNCTIONS; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } + + public function variableProvider(): array + { + return [ + 'remove secret field' => [ + [ + 'secret' => 'secret-value', + 'name' => 'test-variable', + ], + [ + 'name' => 'test-variable', + ] + ], + 'handle content without secret' => [ + [ + 'name' => 'test-variable', + ], + [ + 'name' => 'test-variable', + ] + ], + ]; + } + + /** + * @dataProvider variableProvider + */ + public function testVariable(array $content, array $expected): void + { + $model = Response::MODEL_VARIABLE; + + $result = $this->filter->parse($content, $model); + + $this->assertEquals($expected, $result); + } +}