diff --git a/CHANGES.md b/CHANGES.md
index 5c3ab7703a..0a7887c4c9 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,171 +1,204 @@
+# Version 0.6.2 (PRE-RELEASE)
+
+## Features
+
+- New route in Locale API to fetch list of languages
+
+## Bug Fixes
+
+- Fixed custom domain not setting correct domain
+- Fixed wrong SDK method type in avatars browser route
+- Fixed bug denied public documents (*) to be accessed by guest users
+- Fixed cache control issue not allowing collection UI to update properly
+- Fixed a bug where single permission tag in the console was not being saved
+- Added missing webhooks events in the console
+- Added missing option to delete project
+- Fixed a bug where the session was not set properly when the API used an IP with non-standard port as hostname
+- Fixed bug where requests number on the dashboard was hidden when the number got too long
+
+## Security
+
+- [low severity] Patch for email library (https://github.com/advisories/GHSA-f7hx-fqxw-rvvj)
+
+# Version 0.6.1 (PRE-RELEASE)
+
+## Bug Fixes
+
+- Fix for Google OAuth provider not working properly
+- Fix for login error when using a remote host with non-default ports
+- Removed empty activity tab on the document editor
+- Changed upgrade script name to ‘migrate’ to better reflect what it actually does
+- Fixed bug where after clicking the cancel option in the confirmation dialog the button got disabled
+- Fixed a small grammar error in the documents list screen
+
# Version 0.6.0 (PRE-RELEASE)
## Features
-* New collections UI with ability to create and update a collection
-* New documents UI with ability to create and update a document
-* Added support for Flutter iOS & Android apps
-* Added support for default DB document values
-* Exposed health API to all the server SDKs
-* New locale for Khmer
-* Added TypeScript type hinting to the JS SDK (@zevektor)
-* Added LTR/RTL support for markdown editor
-* Added cachebuster to version number on footer
-* New OAuth logos
-* Minor fixes to the dark mode theme
-* Added JSON view for a project user
-* Removed setKey and setMode methods from all client SDKs
+- New collections UI with ability to create and update a collection
+- New documents UI with ability to create and update a document
+- Added support for Flutter iOS & Android apps
+- Added support for default DB document values
+- Exposed health API to all the server SDKs
+- New locale for Khmer
+- Added TypeScript type hinting to the JS SDK (@zevektor)
+- Added LTR/RTL support for markdown editor
+- Added cachebuster to version number on footer
+- New OAuth logos
+- Minor fixes to the dark mode theme
+- Added JSON view for a project user
+- Removed setKey and setMode methods from all client SDKs
## Breaking Changes
-* Updated all the REST API query params to be in camelCase
-* Normalized locale phone codes response body
+- Updated all the REST API query params to be in camelCase
+- Normalized locale phone codes response body
## Bug Fixes
-* Fixed project users logout button
-* Fixed wrong target in database back link
+- Fixed project users logout button
+- Fixed wrong target in database back link
# Version 0.5.3 (PRE-RELEASE)
## Bug Fixes
-* Fixed bug where multiple unique attribute were allowed
-* Blocked forms from being submitted unlimited times
+- Fixed bug where multiple unique attribute were allowed
+- Blocked forms from being submitted unlimited times
# Version 0.5.2 (PRE-RELEASE)
## Bug Fixes
-* Fixed missing attributes in user account
+- Fixed missing attributes in user account
# Version 0.5.1 (PRE-RELEASE)
## Bug Fixes
-* Delayed SSL init when server startup for traefik to be ready for HTTP challenge
-* Enabled easy access to the upgrade tool from the terminal
+- Delayed SSL init when server startup for traefik to be ready for HTTP challenge
+- Enabled easy access to the upgrade tool from the terminal
# Version 0.5.0 (PRE-RELEASE)
## Features
-* Upgraded core API PHP version to 7.4
-* New database rule validation options
-* Allow non-web platform to skip origin header
-* Limited console dashboard to show max 5 alerts at the same time
-* Added more webhooks events
-* Normailized all webhooks event names
-* Added support for SameSite cookie option with fallback cookie for old clients
-* Added a new Discord OAuth adapter
-* Added a new Twitch OAuth adapter
-* Added a new Spotify OAuth adapter
-* Added a new Yahoo OAuth adapter
-* Added a new Salesforce OAuth adapter
-* Added a new Yandex OAuth adapter
-* Added a new Paypal OAuth adapter
-* Added a new Bitly OAuth adapter
-* Upgraded MariaDB image to version 1.0.2
-* Upgraded SMTP image to version 1.0.1
-* File upload route (POST /v1/storage/files) now accept a single file per request
-* Added ENV vars to change system email sender name and address
-* Usage for requests made by project admin in the console are not counted as API usage
-* Added ENV var to change default file upload size limit. New default value is 100MB
-* Added option to delete file directly from the dashboard
-* Added option to view file preview from the dashboard
-* Added option to add custom domains with auto SSL certificate generator
+- Upgraded core API PHP version to 7.4
+- New database rule validation options
+- Allow non-web platform to skip origin header
+- Limited console dashboard to show max 5 alerts at the same time
+- Added more webhooks events
+- Normailized all webhooks event names
+- Added support for SameSite cookie option with fallback cookie for old clients
+- Added a new Discord OAuth adapter
+- Added a new Twitch OAuth adapter
+- Added a new Spotify OAuth adapter
+- Added a new Yahoo OAuth adapter
+- Added a new Salesforce OAuth adapter
+- Added a new Yandex OAuth adapter
+- Added a new Paypal OAuth adapter
+- Added a new Bitly OAuth adapter
+- Upgraded MariaDB image to version 1.0.2
+- Upgraded SMTP image to version 1.0.1
+- File upload route (POST /v1/storage/files) now accept a single file per request
+- Added ENV vars to change system email sender name and address
+- Usage for requests made by project admin in the console are not counted as API usage
+- Added ENV var to change default file upload size limit. New default value is 100MB
+- Added option to delete file directly from the dashboard
+- Added option to view file preview from the dashboard
+- Added option to add custom domains with auto SSL certificate generator
## Bug Fixes
-* Fixed bug where user status was saved as a string instead of an integer
-* Fixed gravatar icons not showing up correctly on the console
-* Fixed code location of project not found error
-* Fixed bug where tags element would ignore tab key for parsing new tags
-* Fixed OAuth login error saying project UID is missing when its not
-* Fixed wrong input validation for user preferences
+- Fixed bug where user status was saved as a string instead of an integer
+- Fixed gravatar icons not showing up correctly on the console
+- Fixed code location of project not found error
+- Fixed bug where tags element would ignore tab key for parsing new tags
+- Fixed OAuth login error saying project UID is missing when its not
+- Fixed wrong input validation for user preferences
## Breaking Changes
-* Merged Auth and Account service route to make the API REST compatible
+- Merged Auth and Account service route to make the API REST compatible
# Version 0.4.0 (PRE-RELEASE)
## Features
-* Added 5 new locales for locale service and email templates (is, ml, th, fo, ph, pn)
-* 2 stage Docker build
-* Limit HTTP origin check only to browser integrations
-* Updated new Brexit date to 31-01-2020
-* Added a version number to sign in and signup pages for easier debugging of issues
-* Preparation for adding SameSite cookie option support
-* Using native Docker volumes for setup for better cross-platform support and easier management of read/write permissions
-* Added support for custom SSL certificates without needing to set a proxy
-* Added project UID validation check when making an API call. This should help developers to understand our authentication errors better.
-* Updated ClamAV docker image to version 1.0.7
-* Updated MariaDB docker image to version 1.0.1
-* Core Docker image size reduced to 127MB
+- Added 5 new locales for locale service and email templates (is, ml, th, fo, ph, pn)
+- 2 stage Docker build
+- Limit HTTP origin check only to browser integrations
+- Updated new Brexit date to 31-01-2020
+- Added a version number to sign in and signup pages for easier debugging of issues
+- Preparation for adding SameSite cookie option support
+- Using native Docker volumes for setup for better cross-platform support and easier management of read/write permissions
+- Added support for custom SSL certificates without needing to set a proxy
+- Added project UID validation check when making an API call. This should help developers to understand our authentication errors better.
+- Updated ClamAV docker image to version 1.0.7
+- Updated MariaDB docker image to version 1.0.1
+- Core Docker image size reduced to 127MB
## Security
-* [PHP-FPM security patch fix](https://bugs.php.net/patch-display.php?bug_id=78599&patch=0001-Fix-bug-78599-env_path_info-underflow-can-lead-to-RC.patch&revision=latest) - Upgraded PHP version to 7.3.12 [Major]
-* Remove executable permission from avatars files [Minor]
-* Updated SDK Generator Twig dependency with security issue: https://www.exploit-db.com/exploits/44102 [Minor]
+- [PHP-FPM security patch fix](https://bugs.php.net/patch-display.php?bug_id=78599&patch=0001-Fix-bug-78599-env_path_info-underflow-can-lead-to-RC.patch&revision=latest) - Upgraded PHP version to 7.3.12 [Major]
+- Remove executable permission from avatars files [Minor]
+- Updated SDK Generator Twig dependency with security issue: https://www.exploit-db.com/exploits/44102 [Minor]
## Bug Fixes
-* New loading message when creating a new project
-* Fixed broken redirect URL when creating a new project
-* Fixed broken modal when a user password is too short
-* Fixed issue denying the creation of session cookies on localhosts with port other than 80 or 443
-* Fixed bug that prevented actual file size calculation
-* Fixed MariaDB SQL abuse table time field-type
-* Fixed error message not showing up in console failed signup
-* Fixed cookie session not being appropriately set when accessing the console from IP hostname
+- New loading message when creating a new project
+- Fixed broken redirect URL when creating a new project
+- Fixed broken modal when a user password is too short
+- Fixed issue denying the creation of session cookies on localhosts with port other than 80 or 443
+- Fixed bug that prevented actual file size calculation
+- Fixed MariaDB SQL abuse table time field-type
+- Fixed error message not showing up in console failed signup
+- Fixed cookie session not being appropriately set when accessing the console from IP hostname
## Breaking Changes
-* OAuth path is now /auth/login/oauth instead of /auth/oauth and /auth/oauth/callback is now /auth/login/oauth/callback, this is for better consistency with new login methods we will introduce in the future
-* Changed file attribute sizeCompressed to sizeActual to better reflect server logic
+- OAuth path is now /auth/login/oauth instead of /auth/oauth and /auth/oauth/callback is now /auth/login/oauth/callback, this is for better consistency with new login methods we will introduce in the future
+- Changed file attribute sizeCompressed to sizeActual to better reflect server logic
# Version 0.3.0 (PRE-RELEASE)
## Features
-* Added 19 new locales for locale service and email templates (af, ar, bn, cz, hu, hy, jv, ko, lt, ml, no, ru, si, sq, sv, ta, vi, zh-cn, zh-tw)
-* New users service routes to allow updates pref and name update
-* New OAuth adapters (Amazon, Dropbox, Microsoft, Slack, VK)
-* Added support for ES6 require statements in JS SDK
-* New Locale API route for fetching a list of continents
+- Added 19 new locales for locale service and email templates (af, ar, bn, cz, hu, hy, jv, ko, lt, ml, no, ru, si, sq, sv, ta, vi, zh-cn, zh-tw)
+- New users service routes to allow updates pref and name update
+- New OAuth adapters (Amazon, Dropbox, Microsoft, Slack, VK)
+- Added support for ES6 require statements in JS SDK
+- New Locale API route for fetching a list of continents
## Bug Fixes
-* Fix for typos in PT-BR translations
-* Fix for UI crash when project user was missing a name
-* Fix for it locale including the en templates by mistake
-* Fix for UI not showing user's prefs properly
-* Fixed 401 unexpected error when no permission passed in creation of a new resource
+- Fix for typos in PT-BR translations
+- Fix for UI crash when project user was missing a name
+- Fix for it locale including the en templates by mistake
+- Fix for UI not showing user's prefs properly
+- Fixed 401 unexpected error when no permission passed in creation of a new resource
## Breaking Changes
-* users/deleteUsersSession method name changed to users/deleteUserSession in all SDKs for better consistency
+- users/deleteUsersSession method name changed to users/deleteUserSession in all SDKs for better consistency
# Version 0.2.0 (PRE-RELEASE)
## Features
-* Added option to limit access to the Appwrite console
-* Added option to disable abuse check and rate limits
-* Added input field with the server API endpoint for easy access
-* Added new OAuth providers for Google, Bitbucket, and GitLab
-* Added 15 new locales for locale service and email templates (cat, de, es, fi, fr, gr, hi, id, it, nl, pt-br, pt-pt, ro, tr, ua)
-* Improved test coverage for the project and synced DEV & CI environments settings
+- Added option to limit access to the Appwrite console
+- Added option to disable abuse check and rate limits
+- Added input field with the server API endpoint for easy access
+- Added new OAuth providers for Google, Bitbucket, and GitLab
+- Added 15 new locales for locale service and email templates (cat, de, es, fi, fr, gr, hi, id, it, nl, pt-br, pt-pt, ro, tr, ua)
+- Improved test coverage for the project and synced DEV & CI environments settings
## Bug Fixes
-* Fixed bug not allowing to update OAuth providers settings
-* Fixed some broken API examples in docs
-* Fixed bug that caused the Appwrite container to change DB directory file permissions.
+- Fixed bug not allowing to update OAuth providers settings
+- Fixed some broken API examples in docs
+- Fixed bug that caused the Appwrite container to change DB directory file permissions.
## Breaking Changes
-* Changed auth service 'redirect' param to 'confirm' for better clarity
-* Updated all SDKs to sync with API changes
+- Changed auth service 'redirect' param to 'confirm' for better clarity
+- Updated all SDKs to sync with API changes
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f585217755..83321193d9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -158,7 +158,7 @@ Before running the command, make sure you have proper write permissions to the A
To run tests manually, run phpunit from your command line:
```bash
-docker exec appwrite /bin/bash -c '/usr/share/nginx/html/vendor/bin/phpunit'
+docker exec appwrite test
```
## Tutorials
diff --git a/Dockerfile b/Dockerfile
index 039fe3be6d..3cc0c8465a 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -53,6 +53,7 @@ ENV TZ=Asia/Tel_Aviv \
_APP_OPTIONS_ABUSE=enabled \
_APP_OPENSSL_KEY_V1=your-secret-key \
_APP_STORAGE_LIMIT=104857600 \
+ _APP_STORAGE_ANTIVIRUS=enabled \
_APP_REDIS_HOST=redis \
_APP_REDIS_PORT=6379 \
_APP_DB_HOST=mariadb \
@@ -111,6 +112,7 @@ COPY ./docker/www.conf /etc/php/$PHP_VERSION/fpm/pool.d/www.conf
# Add PHP Source Code
COPY ./app /usr/share/nginx/html/app
+COPY ./bin /usr/local/bin
COPY ./docs /usr/share/nginx/html/docs
COPY ./public /usr/share/nginx/html/public
COPY ./src /usr/share/nginx/html/src
@@ -131,7 +133,6 @@ COPY ./docker/supervisord.conf /etc/supervisord.conf
# Set Upload Limit (default to 100MB)
RUN echo "upload_max_filesize = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
RUN echo "post_max_size = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
-RUN echo "env[TESTME] = your-secret-key" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
RUN echo "opcache.preload_user=www-data" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
RUN echo "opcache.preload=/usr/share/nginx/html/app/preload.php" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini
RUN echo "opcache.preload_user=www-data" >> /etc/php/$PHP_VERSION/cli/conf.d/appwrite.ini
@@ -140,13 +141,10 @@ RUN echo "opcache.preload=/usr/share/nginx/html/app/preload.php" >> /etc/php/$PH
# Add logs file
RUN echo "" >> /var/log/appwrite.log
-# Start
-COPY ./docker/bin/start /start
-RUN chmod 775 /start
-
-# Upgrade
-COPY ./docker/bin/upgrade /upgrade
-RUN chmod 775 /upgrade
+# Executables
+RUN chmod +x /usr/local/bin/start
+RUN chmod +x /usr/local/bin/migrate
+RUN chmod +x /usr/local/bin/test
# Letsencrypt Permissions
RUN mkdir -p /etc/letsencrypt/live/ && chmod -Rf 755 /etc/letsencrypt/live/
@@ -155,4 +153,4 @@ EXPOSE 80
WORKDIR /usr/share/nginx/html
-CMD ["/bin/bash", "/start"]
+CMD ["/bin/bash", "/usr/local/bin/start"]
\ No newline at end of file
diff --git a/README.md b/README.md
index e80338aca0..40f798c647 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
- Simple Backend Server for your [Vue / Angular / React / iOS / Android / Flutter / *ANY OTHER*] Frontend App
+ A complete backend solution for your [Flutter / Vue / Angular / React / iOS / Android / *ANY OTHER*] client app
@@ -14,14 +14,9 @@
[](https://twitter.com/appwrite_io)
[](https://stackshare.io/appwrite)
+Appwrite is an end-to-end backend server for Web, Mobile, Native, or Backend apps packaged as a set of Docker microservices. Appwrite abstract the complexity and repetitiveness required to build a modern backend API from scratch to allow you to build secure apps faster.
-Appwrite is a simple self-hosted backend server for web and mobile developers with a shiny dashboard and a very easy-to-use REST API.
-
-Appwrite API services aim to make developer's life a lot easier by hiding the complexity of common and repetitive software development tasks.
-
-Using Appwrite, you can easily manage user authentication with multiple sign-in methods, a database for storing and querying user and team data, storage and file management, image manipulation and cropping, schedule cron tasks and many other features to help you get more results in faster times and with a lot less code.
-
-Appwrite can also integrate really well with your backend. Appwrite can word behind your own proxy facing your internal network, or alongside your own custom backend. You can use Appwrite server SDK to integrate your backend with Appwrite's APIs and webhooks.
+Using Appwrite, you can easily integrate your app with user authentication & multiple sign-in methods, a database for storing and querying users and team data, storage and file management, image manipulation, schedule CRON tasks, and [more services](https://appwrite.io/docs).
[https://appwrite.io](https://appwrite.io)
@@ -30,10 +25,15 @@ Appwrite can also integrate really well with your backend. Appwrite can word beh
Table of Contents:
- [Installation](#installation)
- - [Changing Port Number](#changing-port-number)
+ - [Unix](#unix)
+ - [Windows](#windows)
+ - [CMD](#cmd)
+ - [PowerShell](#powershell)
- [Getting Started](#getting-started)
- [Services](#services)
- [SDKs](#sdks)
+ - [Client](#client)
+ - [Server](#server)
- [Security](#security)
- [Follow Us](#follow-us)
- [Contributing](#contributing)
@@ -45,58 +45,82 @@ Appwrite backend server is designed to run in a container environment. Running y
The easiest way to start running your Appwrite server is by running our docker-compose file. Before running the installation command make sure you have [Docker](https://www.docker.com/products/docker-desktop) installed on your machine:
+### Unix
+
```bash
docker run -it --rm \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume "$(pwd)"/appwrite:/install/appwrite:rw \
- -e version=0.5.3 \
+ -e version=0.6.1 \
+ appwrite/install
+```
+
+### Windows
+
+#### CMD
+
+```cmd
+docker run -it --rm ^
+ --volume //var/run/docker.sock:/var/run/docker.sock ^
+ --volume "%cd%"/appwrite:/install/appwrite:rw ^
+ -e version=0.6.1 ^
+ appwrite/install
+```
+
+#### PowerShell
+
+```powershell
+docker run -it --rm ,
+ --volume /var/run/docker.sock:/var/run/docker.sock ,
+ --volume ${pwd}/appwrite:/install/appwrite:rw ,
+ -e version=0.6.1 ,
appwrite/install
```
Once the Docker installation completes, 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 installation completes.
-For advanced production and custom installation, check out our Docker [environment variables](docs/tutorials/environment-variables.md) docs.
-
-### Changing Port Number
-
-In case your port 80 is already taken, change the port number in the command above. Make sure to set the correct endpoint in your selected SDK, including your new port number.
+For advanced production and custom installation, check out our Docker [environment variables](docs/tutorials/environment-variables.md) docs. You can also use our public [docker-compose.yml](https://appwrite.io/docker-compose.yml) file to manually set up and environment.
## Getting Started
Getting started with Appwrite is as easy as creating a new project, choosing your platform and integrating its SDK in your code. You can easily get started with your platform of choice by reading one of our Getting Started tutorials.
* [Getting Started for Web](https://appwrite.io/docs/getting-started-for-web)
+* [Getting Started for Flutter](https://appwrite.io/docs/getting-started-for-flutter)
* [Getting Started for Server](https://appwrite.io/docs/getting-started-for-server)
* Getting Started for Android (soon...)
* Getting Started for iOS (soon...)
### Services
-* [**Account**](https://appwrite.io/docs/account) - Manage current user authentication and account. Track and manage the user sessions, devices, sign-in methods, and security logs.
-* [**Users**](https://appwrite.io/docs/users) - Manage and list all project users when in admin mode.
-* [**Teams**](https://appwrite.io/docs/teams) - Manage and group users in teams. Manage memberships, invites, and user roles within a team.
-* [**Database**](https://appwrite.io/docs/database) - Manage database collections and documents. Read, create, update, and delete documents and filter lists of documents collections using an advanced filter with graph-like capabilities.
-* [**Storage**](https://appwrite.io/docs/storage) - Manage storage files. Read, create, delete, and preview files. Manipulate the preview of your files to fit your app perfectly. All files are scanned by ClamAV and stored in a secure and encrypted way.
-* [**Locale**](https://appwrite.io/docs/locale) - Track your user's location, and manage your app locale-based data.
-* [**Avatars**](https://appwrite.io/docs/avatars) - Manage your users' avatars, countries' flags, browser icons, credit card symbols, and generate QR codes.
+* [**Account**](https://appwrite.io/docs/client/account) - Manage current user authentication and account. Track and manage the user sessions, devices, sign-in methods, and security logs.
+* [**Users**](https://appwrite.io/docs/server/users) - Manage and list all project users when in admin mode.
+* [**Teams**](https://appwrite.io/docs/client/teams) - Manage and group users in teams. Manage memberships, invites, and user roles within a team.
+* [**Database**](https://appwrite.io/docs/client/database) - Manage database collections and documents. Read, create, update, and delete documents and filter lists of documents collections using an advanced filter with graph-like capabilities.
+* [**Storage**](https://appwrite.io/docs/client/storage) - Manage storage files. Read, create, delete, and preview files. Manipulate the preview of your files to fit your app perfectly. All files are scanned by ClamAV and stored in a secure and encrypted way.
+* [**Locale**](https://appwrite.io/docs/client/locale) - Track your user's location, and manage your app locale-based data.
+* [**Avatars**](https://appwrite.io/docs/client/avatars) - Manage your users' avatars, countries' flags, browser icons, credit card symbols, and generate QR codes.
-For the complete API documentation, visit [https://appwrite.io/docs](https://appwrite.io/docs). For more tutorials, news and announcements check out our [blog](https://medium.com/appwrite-io).
+For the complete API documentation, visit [https://appwrite.io/docs](https://appwrite.io/docs). For more tutorials, news and announcements check out our [blog](https://medium.com/appwrite-io) and [Discord Server](https://discord.gg/GSeTUeA).
### SDKs
-Currently, we support only a few SDK libraries and are constantly working on including new ones.
-
Below is a list of currently supported platforms and languages. If you wish to help us add support to your platform of choice, you can go over to our [SDK Generator](https://github.com/appwrite/sdk-generator) project and view our [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md).
-* ✅ [JS](https://github.com/appwrite/sdk-for-js) (Maintained by the Appwrite Team)
+#### Client
+* ✅ [Web](https://github.com/appwrite/sdk-for-js) (Maintained by the Appwrite Team)
+* ✅ [Flutter](https://github.com/appwrite/sdk-for-flutter) (Maintained by the Appwrite Team)
+
+#### Server
* ✅ [NodeJS](https://github.com/appwrite/sdk-for-node) (Maintained by the Appwrite Team)
* ✅ [PHP](https://github.com/appwrite/sdk-for-php) (Maintained by the Appwrite Team)
+* ✅ [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Beta** (Maintained by the Appwrite Team)
+* ✅ [Python](https://github.com/appwrite/sdk-for-python) - **Beta** (Maintained by the Appwrite Team)
* ✅ [Go](https://github.com/appwrite/sdk-for-go) **Work in progress** (Maintained by the Appwrite Team)
* ✅ [Dart](https://github.com/appwrite/sdk-for-dart) **Work in progress** (Maintained by the Appwrite Team)
-* ✅ [Ruby](https://github.com/appwrite/sdk-for-ruby) - **Work in progress** (Maintained by the Appwrite Team)
-* ✅ [Python](https://github.com/appwrite/sdk-for-python) - **Work in progress** (Maintained by the Appwrite Team)
-* ✳️ Looking for more SDKs? - Help us by contributing a pull request to our [SDK Generator](https://github.com/appwrite/sdk-generator)!
+
+Looking for more SDKs? - Help us by contributing a pull request to our [SDK Generator](https://github.com/appwrite/sdk-generator)!
## Security
diff --git a/app/app.php b/app/app.php
index e22d5dc24b..9fba836c24 100644
--- a/app/app.php
+++ b/app/app.php
@@ -27,6 +27,7 @@ $services = include __DIR__.'/config/services.php'; // List of services
$webhook = new Event('v1-webhooks', 'WebhooksV1');
$audit = new Event('v1-audits', 'AuditsV1');
$usage = new Event('v1-usage', 'UsageV1');
+$deletes = new Event('v1-deletes', 'DeletesV1');
/**
* Get All verified client URLs for both console and current projects
@@ -68,11 +69,12 @@ $utopia->init(function () use ($utopia, $request, $response, &$user, $project, $
$refDomain = $protocol.'://'.((in_array($origin, $clients))
? $origin : 'localhost') . (!empty($port) ? ':'.$port : '');
- $selfDomain = new Domain(Config::getParam('domain'));
+ $selfDomain = new Domain(Config::getParam('hostname'));
$endDomain = new Domain($origin);
Config::setParam('domainVerification',
- ($selfDomain->getRegisterable() === $endDomain->getRegisterable()));
+ ($selfDomain->getRegisterable() === $endDomain->getRegisterable()) &&
+ $endDomain->getRegisterable() !== '');
/*
* Security Headers
@@ -86,7 +88,7 @@ $utopia->init(function () use ($utopia, $request, $response, &$user, $project, $
//->addHeader('X-Frame-Options', ($refDomain == 'http://localhost') ? 'SAMEORIGIN' : 'ALLOW-FROM ' . $refDomain)
->addHeader('X-Content-Type-Options', 'nosniff')
->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE')
- ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-SDK-Version')
+ ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-SDK-Version, Cache-Control, Expires, Pragma')
->addHeader('Access-Control-Expose-Headers', 'X-Fallback-Cookies')
->addHeader('Access-Control-Allow-Origin', $refDomain)
->addHeader('Access-Control-Allow-Credentials', 'true')
@@ -215,10 +217,10 @@ $utopia->init(function () use ($utopia, $request, $response, &$user, $project, $
;
});
-$utopia->shutdown(function () use ($response, $request, $webhook, $audit, $usage, $mode, $project, $utopia) {
+$utopia->shutdown(function () use ($response, $request, $webhook, $audit, $usage, $deletes, $mode, $project, $utopia) {
/*
- * Trigger Events for background jobs
+ * Trigger events for background workers
*/
if (!empty($webhook->getParam('event'))) {
$webhook->trigger();
@@ -228,6 +230,10 @@ $utopia->shutdown(function () use ($response, $request, $webhook, $audit, $usage
$audit->trigger();
}
+ if (!empty($deletes->getParam('document'))) {
+ $deletes->trigger();
+ }
+
$route = $utopia->match($request);
if($project->getId()
@@ -246,7 +252,7 @@ $utopia->options(function () use ($request, $response) {
$response
->addHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE')
- ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-SDK-Version, X-Fallback-Cookies')
+ ->addHeader('Access-Control-Allow-Headers', 'Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-SDK-Version, Cache-Control, Expires, Pragma, X-Fallback-Cookies')
->addHeader('Access-Control-Expose-Headers', 'X-Fallback-Cookies')
->addHeader('Access-Control-Allow-Origin', $origin)
->addHeader('Access-Control-Allow-Credentials', 'true')
diff --git a/app/config/collections.php b/app/config/collections.php
index 4b23a1edde..3b1d167912 100644
--- a/app/config/collections.php
+++ b/app/config/collections.php
@@ -41,7 +41,7 @@ $collections = [
'$collection' => Database::SYSTEM_COLLECTION_PLATFORMS,
'name' => 'Current Host',
'type' => 'web',
- 'hostname' => $request->getServer('HTTP_HOST'),
+ 'hostname' => parse_url('https://'.$request->getServer('HTTP_HOST'), PHP_URL_HOST),
],
],
'legalName' => '',
diff --git a/app/config/events.php b/app/config/events.php
new file mode 100644
index 0000000000..aeee6849f2
--- /dev/null
+++ b/app/config/events.php
@@ -0,0 +1,58 @@
+ [
+ 'description' => 'This event triggers when the account is created.',
+ ],
+ 'account.update.email' => [
+ 'description' => 'This event triggers when the account email address is updated.',
+ ],
+ 'account.update.name' => [
+ 'description' => 'This event triggers when the account name is updated.',
+ ],
+ 'account.update.password' => [
+ 'description' => 'This event triggers when the account password is updated.',
+ ],
+ 'account.update.prefs' => [
+ 'description' => 'This event triggers when the account preferences are updated.',
+ ],
+ 'account.delete' => [
+ 'description' => 'This event triggers when the account is deleted.',
+ ],
+ 'account.sessions.create' => [
+ 'description' => 'This event triggers when the account session is created.',
+ ],
+ 'account.sessions.delete' => [
+ 'description' => 'This event triggers when the account session is deleted.',
+ ],
+ 'database.collections.create' => [
+ 'description' => 'This event triggers when a database collection is created.',
+ ],
+ 'database.collections.update' => [
+ 'description' => 'This event triggers when a database collection is updated.',
+ ],
+ 'database.collections.delete' => [
+ 'description' => 'This event triggers when a database collection is deleted.',
+ ],
+ 'database.documents.create' => [
+ 'description' => 'This event triggers when a database document is created.',
+ ],
+ 'database.documents.patch' => [
+ 'description' => 'This event triggers when a database document is patched.',
+ ],
+ 'database.documents.delete' => [
+ 'description' => 'This event triggers when a database document is deleted.',
+ ],
+ 'storage.files.create' => [
+ 'description' => 'This event triggers when a storage file is created.',
+ ],
+ 'storage.files.update' => [
+ 'description' => 'This event triggers when a storage file is updated.',
+ ],
+ 'storage.files.delete' => [
+ 'description' => 'This event triggers when a storage file is deleted.',
+ ],
+];
\ No newline at end of file
diff --git a/app/config/platforms.php b/app/config/platforms.php
index daaeeceeb1..ed1bf24a0c 100644
--- a/app/config/platforms.php
+++ b/app/config/platforms.php
@@ -1,60 +1,45 @@
[
- 'key' => APP_PLATFORM_WEB,
- 'name' => 'Web',
- 'description' => 'Client libraries for integrating with '.APP_NAME.' to build web-based applications and websites. Read the [getting started for web](/docs/getting-started-for-web) tutorial to start building your first web application.',
+ APP_PLATFORM_CLIENT => [
+ 'key' => APP_PLATFORM_CLIENT,
+ 'name' => 'Client',
+ 'description' => 'Client libraries for integrating with '.APP_NAME.' to build client-based applications and websites. Read the [getting started for web](/docs/getting-started-for-web) or [getting started for Flutter](/docs/getting-started-for-flutter) tutorials to start building your first application.',
'enabled' => true,
'beta' => false,
- 'languages' => [
+ 'languages' => [ // TODO change key to 'sdks'
[
- 'key' => 'javascript',
- 'name' => 'JavaScript',
- 'version' => '1.0.29',
+ 'key' => 'web',
+ 'name' => 'Web',
+ 'version' => '1.1.0',
'url' => 'https://github.com/appwrite/sdk-for-js',
'enabled' => true,
'beta' => false,
'family' => APP_PLATFORM_CLIENT,
'prism' => 'javascript',
- 'source' => realpath(__DIR__ . '/../sdks/web-javascript'),
+ 'source' => realpath(__DIR__ . '/../sdks/client-web'),
'gitUrl' => 'git@github.com:appwrite/sdk-for-js.git',
'gitRepoName' => 'sdk-for-js',
'gitUserName' => 'appwrite',
],
[
- 'key' => 'typescript',
- 'name' => 'TypeScript',
- 'url' => '',
- 'enabled' => false,
+ 'key' => 'flutter',
+ 'name' => 'Flutter',
+ 'version' => '0.2.2',
+ 'url' => 'https://github.com/appwrite/sdk-for-flutter',
+ 'enabled' => true,
'beta' => true,
'family' => APP_PLATFORM_CLIENT,
- 'prism' => 'typescript',
- 'source' => false,
- 'gitUrl' => 'git@github.com:appwrite/sdk-for-typescript.git',
- 'gitRepoName' => 'sdk-for-typescript',
+ 'prism' => 'dart',
+ 'source' => realpath(__DIR__ . '/../sdks/client-flutter'),
+ 'gitUrl' => 'git@github.com:appwrite/sdk-for-flutter.git',
+ 'gitRepoName' => 'sdk-for-flutter',
'gitUserName' => 'appwrite',
],
- ],
- ],
-
- APP_PLATFORM_IOS => [
- 'key' => APP_PLATFORM_IOS,
- 'name' => 'iOS',
- 'description' => 'Client libraries for integrating with '.APP_NAME.' to build iOS applications. Read the [getting started for iOS](/docs/getting-started-for-ios) tutorial to start building your first iOS application.',
- 'enabled' => false,
- 'beta' => false,
- 'languages' => [
[
'key' => 'swift',
'name' => 'Swift',
@@ -81,16 +66,6 @@ return [
'gitRepoName' => 'sdk-for-objective-c',
'gitUserName' => 'appwrite',
],
- ],
- ],
-
- APP_PLATFORM_ANDROID => [
- 'key' => APP_PLATFORM_ANDROID,
- 'name' => 'Android',
- 'description' => 'Client libraries for integrating with '.APP_NAME.' to build Android applications. Read the [getting started for Android](/docs/getting-started-for-android) tutorial to start building your first Android application.',
- 'enabled' => false,
- 'beta' => false,
- 'languages' => [
[
'key' => 'kotlin',
'name' => 'Kotlin',
@@ -104,62 +79,38 @@ return [
'gitRepoName' => 'sdk-for-kotlin',
'gitUserName' => 'appwrite',
],
- [
- 'key' => 'java',
- 'name' => 'Java',
- 'url' => '',
- 'enabled' => false,
- 'beta' => false,
- 'family' => APP_PLATFORM_CLIENT,
- 'prism' => 'java',
- 'source' => false,
- 'gitUrl' => 'git@github.com:appwrite/sdk-for-java.git',
- 'gitRepoName' => 'sdk-for-java',
- 'gitUserName' => 'appwrite',
- ],
+ // [
+ // 'key' => 'java',
+ // 'name' => 'Java',
+ // 'url' => '',
+ // 'enabled' => false,
+ // 'beta' => false,
+ // 'family' => APP_PLATFORM_CLIENT,
+ // 'prism' => 'java',
+ // 'source' => false,
+ // 'gitUrl' => 'git@github.com:appwrite/sdk-for-java.git',
+ // 'gitRepoName' => 'sdk-for-java',
+ // 'gitUserName' => 'appwrite',
+ // ],
],
],
-
- APP_PLATFORM_FLUTTER => [
- 'key' => APP_PLATFORM_FLUTTER,
- 'name' => 'Flutter',
- 'description' => 'Client libraries for integrating with '.APP_NAME.' to build cross-platform Flutter applications. Read the [getting started for Flutter](/docs/getting-started-for-flutter) tutorial to start building your first Flutter application.',
- 'enabled' => true,
- 'beta' => true,
- 'languages' => [
- [
- 'key' => 'dart',
- 'name' => 'Dart',
- 'version' => '0.1.1',
- 'url' => 'https://github.com/appwrite/sdk-for-dart',
- 'enabled' => true,
- 'beta' => true,
- 'family' => APP_PLATFORM_CLIENT,
- 'prism' => 'dart',
- 'source' => realpath(__DIR__ . '/../sdks/flutter-dart'),
- 'gitUrl' => 'git@github.com:appwrite/sdk-for-dart.git',
- 'gitRepoName' => 'sdk-for-dart',
- 'gitUserName' => 'appwrite',
- ],
- ],
- ],
-
+
APP_PLATFORM_CONSOLE => [
'key' => APP_PLATFORM_CONSOLE,
'name' => 'Console',
'enabled' => false,
'beta' => false,
- 'languages' => [
+ 'languages' => [ // TODO change key to 'sdks'
[
- 'key' => 'javascript',
- 'name' => 'JS',
+ 'key' => 'web',
+ 'name' => 'Console',
'version' => '1.0.0',
'url' => 'https://github.com/appwrite/sdk-for-console',
'enabled' => true,
'beta' => false,
'family' => APP_PLATFORM_CONSOLE,
'prism' => 'console',
- 'source' => realpath(__DIR__ . '/../sdks/console-javascript'),
+ 'source' => realpath(__DIR__ . '/../sdks/console-web'),
'gitUrl' => null,
'gitRepoName' => 'sdk-for-console',
'gitUserName' => 'appwrite',
@@ -173,11 +124,11 @@ return [
'description' => 'Libraries for integrating with '.APP_NAME.' to build server side integrations. Read the [getting started for server](/docs/getting-started-for-server) tutorial to start building your first server integration.',
'enabled' => true,
'beta' => false,
- 'languages' => [
+ 'languages' => [ // TODO change key to 'sdks'
[
'key' => 'nodejs',
'name' => 'Node.js',
- 'version' => '1.0.32',
+ 'version' => '1.1.0',
'url' => 'https://github.com/appwrite/sdk-for-node',
'enabled' => true,
'beta' => false,
@@ -188,10 +139,24 @@ return [
'gitRepoName' => 'sdk-for-node',
'gitUserName' => 'appwrite',
],
+ [
+ 'key' => 'deno',
+ 'name' => 'Deno',
+ 'version' => '0.0.1',
+ 'url' => 'https://github.com/appwrite/sdk-for-deno',
+ 'enabled' => false,
+ 'beta' => true,
+ 'family' => APP_PLATFORM_SERVER,
+ 'prism' => 'typescript',
+ 'source' => realpath(__DIR__ . '/../sdks/server-deno'),
+ 'gitUrl' => 'git@github.com:appwrite/sdk-for-deno.git',
+ 'gitRepoName' => 'sdk-for-deno',
+ 'gitUserName' => 'appwrite',
+ ],
[
'key' => 'php',
'name' => 'PHP',
- 'version' => '1.0.17',
+ 'version' => '1.1.0',
'url' => 'https://github.com/appwrite/sdk-for-php',
'enabled' => true,
'beta' => false,
@@ -205,7 +170,7 @@ return [
[
'key' => 'python',
'name' => 'Python',
- 'version' => '0.0.4',
+ 'version' => '0.0.5',
'url' => 'https://github.com/appwrite/sdk-for-python',
'enabled' => true,
'beta' => true,
@@ -219,7 +184,7 @@ return [
[
'key' => 'ruby',
'name' => 'Ruby',
- 'version' => '1.0.9',
+ 'version' => '1.0.10',
'url' => 'https://github.com/appwrite/sdk-for-ruby',
'enabled' => true,
'beta' => true,
@@ -233,9 +198,9 @@ return [
[
'key' => 'go',
'name' => 'Go',
- 'version' => '0.0.6',
+ 'version' => '0.0.7',
'url' => 'https://github.com/appwrite/sdk-for-go',
- 'enabled' => true,
+ 'enabled' => false,
'beta' => true,
'family' => APP_PLATFORM_SERVER,
'prism' => 'go',
@@ -247,9 +212,9 @@ return [
[
'key' => 'java',
'name' => 'Java',
- 'version' => '0.0.1',
+ 'version' => '0.0.2',
'url' => 'https://github.com/appwrite/sdk-for-java',
- 'enabled' => true,
+ 'enabled' => false,
'beta' => true,
'family' => APP_PLATFORM_SERVER,
'prism' => 'java',
@@ -258,7 +223,20 @@ return [
'gitRepoName' => 'sdk-for-java',
'gitUserName' => 'appwrite',
],
+ [
+ 'key' => 'dart',
+ 'name' => 'Dart',
+ 'version' => '0.0.1',
+ 'url' => 'https://github.com/appwrite/sdk-for-dart',
+ 'enabled' => false,
+ 'beta' => true,
+ 'family' => APP_PLATFORM_SERVER,
+ 'prism' => 'java',
+ 'source' => realpath(__DIR__ . '/../sdks/server-dart'),
+ 'gitUrl' => 'git@github.com:appwrite/sdk-for-dart.git',
+ 'gitRepoName' => 'sdk-for-dart',
+ 'gitUserName' => 'appwrite',
+ ],
],
],
-
];
diff --git a/app/config/roles.php b/app/config/roles.php
index e690783172..f462305d97 100644
--- a/app/config/roles.php
+++ b/app/config/roles.php
@@ -58,6 +58,7 @@ return [
'public',
'home',
'console',
+ 'documents.read',
'files.read',
'locale.read',
'avatars.read',
diff --git a/app/config/scopes.php b/app/config/scopes.php
index 53b71dd78f..59ad2a0859 100644
--- a/app/config/scopes.php
+++ b/app/config/scopes.php
@@ -21,4 +21,5 @@ return [ // List of publicly visible scopes
// 'webhooks.write',
'locale.read',
'avatars.read',
+ 'health.read',
];;
\ No newline at end of file
diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php
index b05c244486..a2b7afe0fc 100644
--- a/app/controllers/api/account.php
+++ b/app/controllers/api/account.php
@@ -30,8 +30,8 @@ use GeoIp2\Database\Reader;
include_once __DIR__ . '/../shared/api.php';
-$oauthDefaultSuccess = Config::getParam('protocol').'://'.Config::getParam('domain').'/auth/oauth2/success';
-$oauthDefaultFailure = Config::getParam('protocol').'://'.Config::getParam('domain').'/auth/oauth2/failure';
+$oauthDefaultSuccess = $request->getServer('_APP_HOME').'/auth/oauth2/success';
+$oauthDefaultFailure = $request->getServer('_APP_HOME').'/auth/oauth2/failure';
$oauth2Keys = [];
@@ -251,8 +251,8 @@ $utopia->get('/v1/account/sessions/oauth2/:provider')
->label('abuse-limit', 50)
->label('abuse-key', 'ip:{ip}')
->param('provider', '', function () { return new WhiteList(array_keys(Config::getParam('providers'))); }, 'OAuth2 Provider. Currently, supported providers are: ' . implode(', ', array_keys(array_filter(Config::getParam('providers'), function($node) {return (!$node['mock']);}))).'.')
- ->param('success', $oauthDefaultSuccess, function () use ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a successful login attempt.', true)
- ->param('failure', $oauthDefaultFailure, function () use ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a failed login attempt.', true)
+ ->param('success', $oauthDefaultSuccess, function () use ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true)
+ ->param('failure', $oauthDefaultFailure, function () use ($clients) { return new Host($clients); }, 'URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.', true)
->action(
function ($provider, $success, $failure) use ($response, $request, $project) {
$protocol = Config::getParam('protocol');
@@ -483,6 +483,7 @@ $utopia->get('/v1/account/sessions/oauth2/:provider/redirect')
if($state['success'] === $oauthDefaultSuccess) { // Add keys for non-web platforms
$state['success'] = URLParser::parse($state['success']);
$query = URLParser::parseQuery($state['success']['query']);
+ $query['project'] = $project->getId();
$query['domain'] = COOKIE_DOMAIN;
$query['key'] = Auth::$cookieName;
$query['secret'] = Auth::encodeSession($user->getId(), $secret);
@@ -1026,7 +1027,7 @@ $utopia->post('/v1/account/recovery')
->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},email:{param-email}')
->param('email', '', function () { return new Email(); }, 'User email.')
- ->param('url', '', function () use ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the recovery email.')
+ ->param('url', '', function () use ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the recovery email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.')
->action(
function ($email, $url) use ($request, $response, $projectDB, $register, $audit, $project) {
$profile = $projectDB->getCollection([ // Get user by email address
@@ -1187,7 +1188,7 @@ $utopia->post('/v1/account/verification')
->label('sdk.description', '/docs/references/account/create-verification.md')
->label('abuse-limit', 10)
->label('abuse-key', 'url:{url},email:{param-email}')
- ->param('url', '', function () use ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the verification email.') // TODO add built-in confirm page
+ ->param('url', '', function () use ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the verification email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.') // TODO add built-in confirm page
->action(
function ($url) use ($request, $response, $register, $user, $project, $projectDB, $audit) {
$verificationSecret = Auth::tokenGenerator();
diff --git a/app/controllers/api/avatars.php b/app/controllers/api/avatars.php
index 258df8c47b..571d0fa971 100644
--- a/app/controllers/api/avatars.php
+++ b/app/controllers/api/avatars.php
@@ -99,6 +99,7 @@ $utopia->get('/v1/avatars/credit-cards/:code')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getCreditCard')
+ ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-credit-card.md')
->action(function ($code, $width, $height, $quality) use ($avatarCallback) { return $avatarCallback('credit-cards', $code, $width, $height, $quality);
});
@@ -113,6 +114,7 @@ $utopia->get('/v1/avatars/browsers/:code')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getBrowser')
+ ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-browser.md')
->action(function ($code, $width, $height, $quality) use ($avatarCallback) { return $avatarCallback('browsers', $code, $width, $height, $quality);
});
@@ -127,6 +129,7 @@ $utopia->get('/v1/avatars/flags/:code')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getFlag')
+ ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-flag.md')
->action(function ($code, $width, $height, $quality) use ($avatarCallback) { return $avatarCallback('flags', $code, $width, $height, $quality);
});
@@ -140,6 +143,7 @@ $utopia->get('/v1/avatars/image')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getImage')
+ ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-image.md')
->action(
function ($url, $width, $height) use ($response) {
@@ -206,6 +210,7 @@ $utopia->get('/v1/avatars/favicon')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getFavicon')
+ ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-favicon.md')
->action(
function ($url) use ($response, $request) {
@@ -362,6 +367,7 @@ $utopia->get('/v1/avatars/qr')
->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
->label('sdk.namespace', 'avatars')
->label('sdk.method', 'getQR')
+ ->label('sdk.methodType', 'location')
->label('sdk.description', '/docs/references/avatars/get-qr.md')
->action(
function ($text, $size, $margin, $download) use ($response) {
diff --git a/app/controllers/api/health.php b/app/controllers/api/health.php
index 6bf9aab64f..e244a6b46e 100644
--- a/app/controllers/api/health.php
+++ b/app/controllers/api/health.php
@@ -8,8 +8,8 @@ use Appwrite\Storage\Storage;
use Appwrite\ClamAV\Network;
$utopia->get('/v1/health')
- ->desc('Check API HTTP Health')
- ->label('scope', 'public')
+ ->desc('Get HTTP')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'get')
@@ -21,8 +21,8 @@ $utopia->get('/v1/health')
);
$utopia->get('/v1/health/db')
- ->desc('Check DB Health')
- ->label('scope', 'public')
+ ->desc('Get DB')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getDB')
@@ -36,8 +36,8 @@ $utopia->get('/v1/health/db')
);
$utopia->get('/v1/health/cache')
- ->desc('Check Cache Health')
- ->label('scope', 'public')
+ ->desc('Get Cache')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getCache')
@@ -51,8 +51,8 @@ $utopia->get('/v1/health/cache')
);
$utopia->get('/v1/health/time')
- ->desc('Check Time Health')
- ->label('scope', 'public')
+ ->desc('Get Time')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getTime')
@@ -98,8 +98,8 @@ $utopia->get('/v1/health/time')
);
$utopia->get('/v1/health/queue/webhooks')
- ->desc('Check number of pending webhook messages')
- ->label('scope', 'public')
+ ->desc('Get Webhooks Queue')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueWebhooks')
@@ -111,8 +111,8 @@ $utopia->get('/v1/health/queue/webhooks')
);
$utopia->get('/v1/health/queue/tasks')
- ->desc('Check the number of pending task messages')
- ->label('scope', 'public')
+ ->desc('Get Tasks Queue')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueTasks')
@@ -124,8 +124,8 @@ $utopia->get('/v1/health/queue/tasks')
);
$utopia->get('/v1/health/queue/logs')
-->desc('Check the number of pending log messages')
- ->label('scope', 'public')
+->desc('Get Logs Queue')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueLogs')
@@ -137,8 +137,8 @@ $utopia->get('/v1/health/queue/logs')
);
$utopia->get('/v1/health/queue/usage')
- ->desc('Check the number of pending usage messages')
- ->label('scope', 'public')
+ ->desc('Get Usage Queue')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueUsage')
@@ -150,8 +150,8 @@ $utopia->get('/v1/health/queue/usage')
);
$utopia->get('/v1/health/queue/certificates')
- ->desc('Check the number of pending certificate messages')
- ->label('scope', 'public')
+ ->desc('Get Certificate Queue')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getQueueCertificates')
@@ -162,9 +162,22 @@ $utopia->get('/v1/health/queue/certificates')
}
);
+$utopia->get('/v1/health/queue/functions')
+ ->desc('Get Functions Queue')
+ ->label('scope', 'health.read')
+ ->label('sdk.platform', [APP_PLATFORM_SERVER])
+ ->label('sdk.namespace', 'health')
+ ->label('sdk.method', 'getQueueFunctions')
+ ->label('sdk.description', '/docs/references/health/get-queue-functions.md')
+ ->action(
+ function () use ($response) {
+ $response->json(['size' => Resque::size('v1-functions')]);
+ }
+ );
+
$utopia->get('/v1/health/storage/local')
- ->desc('Check File System Health')
- ->label('scope', 'public')
+ ->desc('Get Local Storage')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
->label('sdk.method', 'getStorageLocal')
@@ -197,15 +210,19 @@ $utopia->get('/v1/health/storage/local')
}
);
-$utopia->get('/v1/health/storage/anti-virus')
- ->desc('Check Anti virus Health')
- ->label('scope', 'public')
+$utopia->get('/v1/health/anti-virus')
+ ->desc('Get Anti virus')
+ ->label('scope', 'health.read')
->label('sdk.platform', [APP_PLATFORM_SERVER])
->label('sdk.namespace', 'health')
- ->label('sdk.method', 'getStorageAntiVirus')
+ ->label('sdk.method', 'getAntiVirus')
->label('sdk.description', '/docs/references/health/get-storage-anti-virus.md')
->action(
- function () use ($response) {
+ function () use ($request, $response) {
+ if($request->getServer('_APP_STORAGE_ANTIVIRUS') === 'disabled') { // Check if scans are enabled
+ throw new Exception('Anitvirus is disabled');
+ }
+
$antiVirus = new Network('clamav', 3310);
$response->json([
@@ -216,7 +233,7 @@ $utopia->get('/v1/health/storage/anti-virus')
);
$utopia->get('/v1/health/stats') // Currently only used internally
- ->desc('System Stats')
+ ->desc('Get System Stats')
->label('scope', 'god')
// ->label('sdk.platform', [APP_PLATFORM_SERVER])
// ->label('sdk.namespace', 'health')
diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php
index 64689904e6..54ccd2dcec 100644
--- a/app/controllers/api/projects.php
+++ b/app/controllers/api/projects.php
@@ -1,6 +1,6 @@
get('/v1/projects/:projectId/usage')
],
'last30' => [
'start' => DateTime::createFromFormat('U', strtotime('-30 days')),
- 'end' => DateTime::createFromFormat('U', strtotime('today')),
+ 'end' => DateTime::createFromFormat('U', strtotime('tomorrow')),
'group' => '1d',
],
'last90' => [
@@ -402,7 +402,7 @@ $utopia->delete('/v1/projects/:projectId')
->param('projectId', '', function () { return new UID(); }, 'Project unique ID.')
->param('password', '', function () { return new UID(); }, 'Your user password for confirmation.')
->action(
- function ($projectId, $password) use ($response, $consoleDB, $user) {
+ function ($projectId, $password) use ($response, $consoleDB, $user, $deletes) {
if (!Auth::passwordVerify($password, $user->getAttribute('password'))) { // Double check user password
throw new Exception('Invalid credentials', 401);
}
@@ -413,20 +413,22 @@ $utopia->delete('/v1/projects/:projectId')
throw new Exception('Project not found', 404);
}
- // Delete all children (keys, webhooks, tasks [stop tasks?], platforms)
+ $deletes->setParam('document', $project->getArrayCopy());
+
+ foreach(['keys', 'webhooks', 'tasks', 'platforms', 'domains'] as $key) { // Delete all children (keys, webhooks, tasks [stop tasks?], platforms)
+ $list = $project->getAttribute('webhooks', []);
+
+ foreach ($list as $document) { /* @var $document Document */
+ if (!$consoleDB->deleteDocument($projectId)) {
+ throw new Exception('Failed to remove project document ('.$key.')] from DB', 500);
+ }
+ }
+ }
if (!$consoleDB->deleteDocument($projectId)) {
throw new Exception('Failed to remove project from DB', 500);
}
- // Delete all DBs
- // $consoleDB->deleteNamespace($project->getId());
-
- // Optimize DB?
-
- // Delete all storage files
- // Delete all storage cache
-
$response->noContent();
}
);
@@ -1229,9 +1231,8 @@ $utopia->post('/v1/projects/:projectId/domains')
->param('projectId', null, function () { return new UID(); }, 'Project unique ID.')
->param('domain', null, function () { return new DomainValidator(); }, 'Domain name.')
->action(
- function ($projectId) use ($request, $response, $consoleDB) {
+ function ($projectId, $domain) use ($request, $response, $consoleDB) {
$project = $consoleDB->getDocument($projectId);
- $domain = Config::getParam('domain');
if (empty($project->getId()) || Database::SYSTEM_COLLECTION_PROJECTS != $project->getCollection()) {
throw new Exception('Project not found', 404);
diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php
index 448eb93511..18a8c98c26 100644
--- a/app/controllers/api/storage.php
+++ b/app/controllers/api/storage.php
@@ -179,8 +179,6 @@ $utopia->post('/v1/storage/files')
throw new Exception('File size not allowed', 400);
}
- $antiVirus = new Network('clamav', 3310);
-
/*
* Models
*/
@@ -200,10 +198,14 @@ $utopia->post('/v1/storage/files')
$mimeType = $device->getFileMimeType($path); // Get mime-type before compression and encryption
- // Check if file size is exceeding allowed limit
- if (!$antiVirus->fileScan($path)) {
- $device->delete($path);
- throw new Exception('Invalid file', 403);
+ if($request->getServer('_APP_STORAGE_ANTIVIRUS') === 'enabled') { // Check if scans are enabled
+ $antiVirus = new Network('clamav', 3310);
+
+ // Check if file size is exceeding allowed limit
+ if (!$antiVirus->fileScan($path)) {
+ $device->delete($path);
+ throw new Exception('Invalid file', 403);
+ }
}
// Compression
@@ -654,53 +656,53 @@ $utopia->delete('/v1/storage/files/:fileId')
}
);
-$utopia->get('/v1/storage/files/:fileId/scan')
- ->desc('Scan Storage')
- ->label('scope', 'god')
- ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
- ->label('sdk.namespace', 'storage')
- ->label('sdk.method', 'getFileScan')
- ->label('sdk.hide', true)
- ->param('fileId', '', function () { return new UID(); }, 'File unique ID.')
- ->param('storage', 'local', function () { return new WhiteList(['local']);})
- ->action(
- function ($fileId, $storage) use ($response, $request, $projectDB) {
- $file = $projectDB->getDocument($fileId);
+// $utopia->get('/v1/storage/files/:fileId/scan')
+// ->desc('Scan Storage')
+// ->label('scope', 'god')
+// ->label('sdk.platform', [APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER])
+// ->label('sdk.namespace', 'storage')
+// ->label('sdk.method', 'getFileScan')
+// ->label('sdk.hide', true)
+// ->param('fileId', '', function () { return new UID(); }, 'File unique ID.')
+// ->param('storage', 'local', function () { return new WhiteList(['local']);})
+// ->action(
+// function ($fileId, $storage) use ($response, $request, $projectDB) {
+// $file = $projectDB->getDocument($fileId);
- if (empty($file->getId()) || Database::SYSTEM_COLLECTION_FILES != $file->getCollection()) {
- throw new Exception('File not found', 404);
- }
+// if (empty($file->getId()) || Database::SYSTEM_COLLECTION_FILES != $file->getCollection()) {
+// throw new Exception('File not found', 404);
+// }
- $path = $file->getAttribute('path', '');
+// $path = $file->getAttribute('path', '');
- if (!file_exists($path)) {
- throw new Exception('File not found in '.$path, 404);
- }
+// if (!file_exists($path)) {
+// throw new Exception('File not found in '.$path, 404);
+// }
- $compressor = new GZIP();
- $device = Storage::getDevice($storage);
+// $compressor = new GZIP();
+// $device = Storage::getDevice($storage);
- $source = $device->read($path);
+// $source = $device->read($path);
- if (!empty($file->getAttribute('fileOpenSSLCipher'))) { // Decrypt
- $source = OpenSSL::decrypt(
- $source,
- $file->getAttribute('fileOpenSSLCipher'),
- $request->getServer('_APP_OPENSSL_KEY_V'.$file->getAttribute('fileOpenSSLVersion')),
- 0,
- hex2bin($file->getAttribute('fileOpenSSLIV')),
- hex2bin($file->getAttribute('fileOpenSSLTag'))
- );
- }
+// if (!empty($file->getAttribute('fileOpenSSLCipher'))) { // Decrypt
+// $source = OpenSSL::decrypt(
+// $source,
+// $file->getAttribute('fileOpenSSLCipher'),
+// $request->getServer('_APP_OPENSSL_KEY_V'.$file->getAttribute('fileOpenSSLVersion')),
+// 0,
+// hex2bin($file->getAttribute('fileOpenSSLIV')),
+// hex2bin($file->getAttribute('fileOpenSSLTag'))
+// );
+// }
- $source = $compressor->decompress($source);
+// $source = $compressor->decompress($source);
- $antiVirus = new Network('clamav', 3310);
+// $antiVirus = new Network('clamav', 3310);
- //var_dump($antiVirus->ping());
- //var_dump($antiVirus->version());
- //var_dump($antiVirus->fileScan('/storage/uploads/app-1/5/9/f/e/59fecaed49645.pdf'));
+// //var_dump($antiVirus->ping());
+// //var_dump($antiVirus->version());
+// //var_dump($antiVirus->fileScan('/storage/uploads/app-1/5/9/f/e/59fecaed49645.pdf'));
- //$response->json($antiVirus->continueScan($device->getRoot()));
- }
- );
+// //$response->json($antiVirus->continueScan($device->getRoot()));
+// }
+// );
diff --git a/app/controllers/api/teams.php b/app/controllers/api/teams.php
index ccea694833..fad09b695e 100644
--- a/app/controllers/api/teams.php
+++ b/app/controllers/api/teams.php
@@ -213,7 +213,7 @@ $utopia->post('/v1/teams/:teamId/memberships')
->param('email', '', function () { return new Email(); }, 'New team member email.')
->param('name', '', function () { return new Text(100); }, 'New team member name.', true)
->param('roles', [], function () { return new ArrayList(new Text(128)); }, 'Array of strings. Use this param to set the user roles in the team. A role can be any string. Learn more about [roles and permissions](/docs/permissions).')
- ->param('url', '', function () use ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the invitation email.') // TODO add our own built-in confirm page
+ ->param('url', '', function () use ($clients) { return new Host($clients); }, 'URL to redirect the user back to your app from the invitation email. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.') // TODO add our own built-in confirm page
->action(
function ($teamId, $email, $name, $roles, $url) use ($response, $register, $project, $user, $audit, $projectDB) {
$name = (empty($name)) ? $email : $name;
diff --git a/app/controllers/shared/web.php b/app/controllers/shared/web.php
index b4fd17ca56..cb2612c0f9 100644
--- a/app/controllers/shared/web.php
+++ b/app/controllers/shared/web.php
@@ -31,7 +31,7 @@ $layout
->setParam('env', $utopia->getEnv())
;
-$utopia->shutdown(function () use ($utopia, $response, $request, $layout) {
+$utopia->init(function () use ($utopia, $response, $request, $layout) {
$time = (60 * 60 * 24 * 45); // 45 days cache
$isDev = (\Utopia\App::ENV_TYPE_DEVELOPMENT == Config::getParam('env'));
diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php
index 70f32693f3..480c4ff9ba 100644
--- a/app/controllers/web/console.php
+++ b/app/controllers/web/console.php
@@ -133,7 +133,11 @@ $utopia->get('/console/webhooks')
->label('scope', 'console')
->action(function () use ($layout) {
$page = new View(__DIR__.'/../../views/console/webhooks/index.phtml');
-
+
+ $page
+ ->setParam('events', Config::getParam('events', []))
+ ;
+
$layout
->setParam('title', APP_NAME.' - Webhooks')
->setParam('body', $page);
@@ -183,7 +187,7 @@ $utopia->get('/console/database/collection')
->label('permission', 'public')
->label('scope', 'console')
->param('id', '', function () { return new UID(); }, 'Collection unique ID.')
- ->action(function ($id) use ($layout, $projectDB) {
+ ->action(function ($id) use ($response, $layout, $projectDB) {
Authorization::disable();
$collection = $projectDB->getDocument($id, false);
Authorization::reset();
@@ -197,10 +201,18 @@ $utopia->get('/console/database/collection')
$page
->setParam('collection', $collection)
;
-
+
$layout
->setParam('title', APP_NAME.' - Database Collection')
- ->setParam('body', $page);
+ ->setParam('body', $page)
+ ;
+
+ $response
+ ->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0')
+ ->addHeader('Expires', 0)
+ ->addHeader('Pragma', 'no-cache')
+ ;
+
});
$utopia->get('/console/database/document')
diff --git a/app/controllers/web/home.php b/app/controllers/web/home.php
index 0871e8c252..f3e4fd72c8 100644
--- a/app/controllers/web/home.php
+++ b/app/controllers/web/home.php
@@ -6,6 +6,8 @@ global $utopia, $response, $request, $layout;
use Utopia\View;
use Utopia\Config\Config;
+use Utopia\Validator\WhiteList;
+use Utopia\Validator\Range;
$header = new View(__DIR__.'/../../views/home/comps/header.phtml');
$footer = new View(__DIR__.'/../../views/home/comps/footer.phtml');
@@ -155,3 +157,401 @@ $utopia->get('/error/:code')
->setParam('title', 'Error'.' - '.APP_NAME)
->setParam('body', $page);
});
+
+$utopia->get('/open-api-2.json')
+ ->label('scope', 'public')
+ ->label('docs', false)
+ ->param('platform', APP_PLATFORM_CLIENT, function () {return new WhiteList([APP_PLATFORM_CLIENT, APP_PLATFORM_SERVER, APP_PLATFORM_CONSOLE]);}, 'Choose target platform.', true)
+ ->param('extensions', 0, function () {return new Range(0, 1);}, 'Show extra data.', true)
+ ->param('tests', 0, function () {return new Range(0, 1);}, 'Include only test services.', true)
+ ->action(
+ function ($platform, $extensions, $tests) use ($response, $request, $utopia, $services) {
+ function fromCamelCase($input)
+ {
+ preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $input, $matches);
+ $ret = $matches[0];
+ foreach ($ret as &$match) {
+ $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match);
+ }
+
+ return implode('_', $ret);
+ }
+
+ function fromCamelCaseToDash($input)
+ {
+ return str_replace([' ', '_'], '-', strtolower(preg_replace('/([a-zA-Z])(?=[A-Z])/', '$1-', $input)));
+ }
+
+ foreach ($services as $service) { /* @noinspection PhpIncludeInspection */
+ if($tests && !isset($service['tests'])) {
+ continue;
+ }
+
+ if($tests && !$service['tests']) {
+ continue;
+ }
+
+ if (!$tests && !$service['sdk']) {
+ continue;
+ }
+
+ /** @noinspection PhpIncludeInspection */
+ include_once realpath(__DIR__.'/../../'.$service['controller']);
+ }
+
+ $security = [
+ APP_PLATFORM_CLIENT => ['Project' => []],
+ APP_PLATFORM_SERVER => ['Project' => [], 'Key' => []],
+ APP_PLATFORM_CONSOLE => ['Project' => [], 'Key' => []],
+ ];
+
+ $platforms = [
+ 'client' => APP_PLATFORM_CLIENT,
+ 'server' => APP_PLATFORM_SERVER,
+ 'all' => APP_PLATFORM_CONSOLE,
+ ];
+
+ $keys = [
+ APP_PLATFORM_CLIENT => [
+ 'Project' => [
+ 'type' => 'apiKey',
+ 'name' => 'X-Appwrite-Project',
+ 'description' => 'Your project ID',
+ 'in' => 'header',
+ ],
+ 'Locale' => [
+ 'type' => 'apiKey',
+ 'name' => 'X-Appwrite-Locale',
+ 'description' => '',
+ 'in' => 'header',
+ ],
+ ],
+ APP_PLATFORM_SERVER => [
+ 'Project' => [
+ 'type' => 'apiKey',
+ 'name' => 'X-Appwrite-Project',
+ 'description' => 'Your project ID',
+ 'in' => 'header',
+ ],
+ 'Key' => [
+ 'type' => 'apiKey',
+ 'name' => 'X-Appwrite-Key',
+ 'description' => 'Your secret API key',
+ 'in' => 'header',
+ ],
+ 'Locale' => [
+ 'type' => 'apiKey',
+ 'name' => 'X-Appwrite-Locale',
+ 'description' => '',
+ 'in' => 'header',
+ ],
+ ],
+ APP_PLATFORM_CONSOLE => [
+ 'Project' => [
+ 'type' => 'apiKey',
+ 'name' => 'X-Appwrite-Project',
+ 'description' => 'Your project ID',
+ 'in' => 'header',
+ ],
+ 'Key' => [
+ 'type' => 'apiKey',
+ 'name' => 'X-Appwrite-Key',
+ 'description' => 'Your secret API key',
+ 'in' => 'header',
+ ],
+ 'Locale' => [
+ 'type' => 'apiKey',
+ 'name' => 'X-Appwrite-Locale',
+ 'description' => '',
+ 'in' => 'header',
+ ],
+ 'Mode' => [
+ 'type' => 'apiKey',
+ 'name' => 'X-Appwrite-Mode',
+ 'description' => '',
+ 'in' => 'header',
+ ],
+ ],
+ ];
+
+ /*
+ * Specifications (v3.0.0):
+ * https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md
+ */
+ $output = [
+ 'swagger' => '2.0',
+ 'info' => [
+ 'version' => APP_VERSION_STABLE,
+ 'title' => APP_NAME,
+ 'description' => 'Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)',
+ 'termsOfService' => 'https://appwrite.io/policy/terms',
+ 'contact' => [
+ 'name' => 'Appwrite Team',
+ 'url' => 'https://appwrite.io/support',
+ 'email' => $request->getServer('_APP_SYSTEM_EMAIL_ADDRESS', APP_EMAIL_TEAM),
+ ],
+ 'license' => [
+ 'name' => 'BSD-3-Clause',
+ 'url' => 'https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE',
+ ],
+ ],
+ 'host' => parse_url($request->getServer('_APP_HOME', Config::getParam('domain')), PHP_URL_HOST),
+ 'basePath' => '/v1',
+ 'schemes' => ['https'],
+ 'consumes' => ['application/json', 'multipart/form-data'],
+ 'produces' => ['application/json'],
+ 'securityDefinitions' => $keys[$platform],
+ 'paths' => [],
+ 'definitions' => [
+ // 'Pet' => [
+ // 'required' => ['id', 'name'],
+ // 'properties' => [
+ // 'id' => [
+ // 'type' => 'integer',
+ // 'format' => 'int64',
+ // ],
+ // 'name' => [
+ // 'type' => 'string',
+ // ],
+ // 'tag' => [
+ // 'type' => 'string',
+ // ],
+ // ],
+ // ],
+ // 'Pets' => array(
+ // 'type' => 'array',
+ // 'items' => array(
+ // '$ref' => '#/definitions/Pet',
+ // ),
+ // ),
+ 'Error' => array(
+ 'required' => array(
+ 0 => 'code',
+ 1 => 'message',
+ ),
+ 'properties' => array(
+ 'code' => array(
+ 'type' => 'integer',
+ 'format' => 'int32',
+ ),
+ 'message' => array(
+ 'type' => 'string',
+ ),
+ ),
+ ),
+ ],
+ 'externalDocs' => [
+ 'description' => 'Full API docs, specs and tutorials',
+ 'url' => Config::getParam('protocol').'://'.Config::getParam('domain').'/docs',
+ ],
+ ];
+
+ if ($extensions) {
+ if(isset($output['securityDefinitions']['Project'])) {
+ $output['securityDefinitions']['Project']['extensions'] = ['demo' => '5df5acd0d48c2'];
+ }
+
+ if(isset($output['securityDefinitions']['Key'])) {
+ $output['securityDefinitions']['Key']['extensions'] = ['demo' => '919c2d18fb5d4...a2ae413da83346ad2'];
+ }
+
+ if(isset($output['securityDefinitions']['Locale'])) {
+ $output['securityDefinitions']['Locale']['extensions'] = ['demo' => 'en'];
+ }
+
+ if(isset($output['securityDefinitions']['Mode'])) {
+ $output['securityDefinitions']['Mode']['extensions'] = ['demo' => ''];
+ }
+ }
+
+ foreach ($utopia->getRoutes() as $key => $method) {
+ foreach ($method as $route) { /* @var $route \Utopia\Route */
+ if (!$route->getLabel('docs', true)) {
+ continue;
+ }
+
+ if (empty($route->getLabel('sdk.namespace', null))) {
+ continue;
+ }
+
+ if($platform !== APP_PLATFORM_CONSOLE && !in_array($platforms[$platform], $route->getLabel('sdk.platform', []))) {
+ continue;
+ }
+
+ $url = str_replace('/v1', '', $route->getURL());
+ $scope = $route->getLabel('scope', '');
+ $hide = $route->getLabel('sdk.hide', false);
+ $consumes = ['application/json'];
+
+ if ($hide) {
+ continue;
+ }
+
+ $desc = (!empty($route->getLabel('sdk.description', ''))) ? realpath('../'.$route->getLabel('sdk.description', '')) : null;
+
+ $temp = [
+ 'summary' => $route->getDesc(),
+ 'operationId' => $route->getLabel('sdk.method', uniqid()),
+ 'consumes' => [],
+ 'tags' => [$route->getLabel('sdk.namespace', 'default')],
+ 'description' => ($desc) ? file_get_contents($desc) : '',
+
+ // 'responses' => [
+ // 200 => [
+ // 'description' => 'An paged array of pets',
+ // 'schema' => [
+ // '$ref' => '#/definitions/Pet',
+ // ],
+ // ],
+ // ],
+ ];
+
+ if ($extensions) {
+ $platformList = $route->getLabel('sdk.platform', []);
+
+ $temp['extensions'] = [
+ 'weight' => $route->getOrder(),
+ 'cookies' => $route->getLabel('sdk.cookies', false),
+ 'type' => $route->getLabel('sdk.methodType', ''),
+ 'demo' => 'docs/examples/'.fromCamelCaseToDash($route->getLabel('sdk.namespace', 'default')).'/'.fromCamelCaseToDash($temp['operationId']).'.md',
+ 'edit' => 'https://github.com/appwrite/appwrite/edit/master' . $route->getLabel('sdk.description', ''),
+ 'rate-limit' => $route->getLabel('abuse-limit', 0),
+ 'rate-time' => $route->getLabel('abuse-time', 3600),
+ 'scope' => $route->getLabel('scope', ''),
+ 'platforms' => $platformList,
+ ];
+ }
+
+ if ((!empty($scope))) { // && 'public' != $scope
+ $temp['security'][] = $route->getLabel('sdk.security', $security[$platform]);
+ }
+
+ $requestBody = [
+ 'content' => [
+ 'application/x-www-form-urlencoded' => [
+ 'schema' => [
+ 'type' => 'object',
+ 'properties' => [],
+ ],
+ 'required' => [],
+ ],
+ ],
+ ];
+
+ foreach ($route->getParams() as $name => $param) {
+ $validator = (is_callable($param['validator'])) ? $param['validator']() : $param['validator']; /* @var $validator \Utopia\Validator */
+
+ $node = [
+ 'name' => $name,
+ 'description' => $param['description'],
+ 'required' => !$param['optional'],
+ ];
+
+ switch ((!empty($validator)) ? get_class($validator) : '') {
+ case 'Utopia\Validator\Text':
+ $node['type'] = 'string';
+ $node['x-example'] = '['.strtoupper(fromCamelCase($node['name'])).']';
+ break;
+ case 'Appwrite\Database\Validator\UID':
+ $node['type'] = 'string';
+ $node['x-example'] = '['.strtoupper(fromCamelCase($node['name'])).']';
+ break;
+ case 'Utopia\Validator\Email':
+ $node['type'] = 'string';
+ $node['format'] = 'email';
+ $node['x-example'] = 'email@example.com';
+ break;
+ case 'Utopia\Validator\URL':
+ $node['type'] = 'string';
+ $node['format'] = 'url';
+ $node['x-example'] = 'https://example.com';
+ break;
+ case 'Utopia\Validator\JSON':
+ case 'Utopia\Validator\Mock':
+ case 'Utopia\Validator\Assoc':
+ $node['type'] = 'object';
+ $node['type'] = 'object';
+ $node['x-example'] = '{}';
+ //$node['format'] = 'json';
+ break;
+ case 'Appwrite\Storage\Validators\File':
+ $consumes = ['multipart/form-data'];
+ $node['type'] = 'file';
+ break;
+ case 'Utopia\Validator\ArrayList':
+ $node['type'] = 'array';
+ $node['collectionFormat'] = 'multi';
+ $node['items'] = [
+ 'type' => 'string',
+ ];
+ break;
+ case 'Appwrite\Auth\Validator\Password':
+ $node['type'] = 'string';
+ $node['format'] = 'format';
+ $node['x-example'] = 'password';
+ break;
+ case 'Utopia\Validator\Range': /* @var $validator \Utopia\Validator\Range */
+ $node['type'] = 'integer';
+ $node['format'] = 'int32';
+ $node['x-example'] = $validator->getMin();
+ break;
+ case 'Utopia\Validator\Numeric':
+ $node['type'] = 'integer';
+ $node['format'] = 'int32';
+ break;
+ case 'Utopia\Validator\Length':
+ $node['type'] = 'string';
+ break;
+ case 'Utopia\Validator\Host':
+ $node['type'] = 'string';
+ $node['format'] = 'url';
+ $node['x-example'] = 'https://example.com';
+ break;
+ case 'Utopia\Validator\WhiteList': /* @var $validator \Utopia\Validator\WhiteList */
+ $node['type'] = 'string';
+ $node['x-example'] = $validator->getList()[0];
+ break;
+ default:
+ $node['type'] = 'string';
+ break;
+ }
+
+ if ($param['optional'] && !is_null($param['default'])) { // Param has default value
+ $node['default'] = $param['default'];
+ }
+
+ if (false !== strpos($url, ':'.$name)) { // Param is in URL path
+ $node['in'] = 'path';
+ $temp['parameters'][] = $node;
+ } elseif ($key == 'GET') { // Param is in query
+ $node['in'] = 'query';
+ $temp['parameters'][] = $node;
+ } else { // Param is in payload
+ $node['in'] = 'formData';
+ $temp['parameters'][] = $node;
+ $requestBody['content']['application/x-www-form-urlencoded']['schema']['properties'][] = $node;
+
+ if (!$param['optional']) {
+ $requestBody['content']['application/x-www-form-urlencoded']['required'][] = $name;
+ }
+ }
+
+ $url = str_replace(':'.$name, '{'.$name.'}', $url);
+ }
+
+ $temp['consumes'] = $consumes;
+
+ $output['paths'][$url][strtolower($route->getMethod())] = $temp;
+ }
+ }
+
+ /*foreach ($consoleDB->getMocks() as $mock) {
+ var_dump($mock['name']);
+ }*/
+
+ ksort($output['paths']);
+
+ $response
+ ->json($output);
+ }
+ );
\ No newline at end of file
diff --git a/app/init.php b/app/init.php
index 68f45400c8..98df754775 100644
--- a/app/init.php
+++ b/app/init.php
@@ -33,7 +33,7 @@ const APP_USERAGENT = APP_NAME.'-Server v%s. Please report abuse at %s';
const APP_MODE_ADMIN = 'admin';
const APP_PAGING_LIMIT = 15;
const APP_CACHE_BUSTER = 125;
-const APP_VERSION_STABLE = '0.5.3';
+const APP_VERSION_STABLE = '0.6.1';
const APP_STORAGE_UPLOADS = '/storage/uploads';
const APP_STORAGE_CACHE = '/storage/cache';
const APP_STORAGE_CERTIFICATES = '/storage/certificates';
@@ -45,6 +45,7 @@ const APP_SOCIAL_LINKEDIN = 'https://www.linkedin.com/company/appwrite';
const APP_SOCIAL_INSTAGRAM = 'https://www.instagram.com/appwrite.io';
const APP_SOCIAL_GITHUB = 'https://github.com/appwrite';
const APP_SOCIAL_DISCORD = 'https://discord.gg/GSeTUeA';
+const APP_SOCIAL_DEV = 'https://dev.to/appwrite';
$register = new Registry();
$request = new Request();
@@ -53,6 +54,7 @@ $response = new Response();
/*
* ENV vars
*/
+Config::load('events', __DIR__.'/../app/config/events.php');
Config::load('providers', __DIR__.'/../app/config/providers.php');
Config::load('platforms', __DIR__.'/../app/config/platforms.php');
Config::load('locales', __DIR__.'/../app/config/locales.php');
@@ -64,6 +66,7 @@ Config::setParam('domainVerification', false);
Config::setParam('version', $request->getServer('_APP_VERSION', 'UNKNOWN'));
Config::setParam('protocol', $request->getServer('HTTP_X_FORWARDED_PROTO', $request->getServer('REQUEST_SCHEME', 'https')));
Config::setParam('port', (string) parse_url(Config::getParam('protocol').'://'.$request->getServer('HTTP_HOST', ''), PHP_URL_PORT));
+Config::setParam('hostname', parse_url(Config::getParam('protocol').'://'.$request->getServer('HTTP_HOST', null), PHP_URL_HOST));
$utopia = new App('Asia/Tel_Aviv', Config::getParam('env'));
@@ -74,10 +77,11 @@ define('COOKIE_DOMAIN',
(
$request->getServer('HTTP_HOST', null) === 'localhost' ||
$request->getServer('HTTP_HOST', null) === 'localhost:'.Config::getParam('port') ||
- (filter_var($request->getServer('HTTP_HOST', null), FILTER_VALIDATE_IP) !== false)
+ (filter_var(Config::getParam('hostname'), FILTER_VALIDATE_IP) !== false)
)
? null
- : '.'.parse_url(Config::getParam('protocol').'://'.$request->getServer('HTTP_HOST', ''), PHP_URL_HOST));
+ : '.'.Config::getParam('hostname')
+ );
define('COOKIE_SAMESITE', Response::COOKIE_SAMESITE_NONE);
/*
@@ -254,7 +258,7 @@ if (APP_MODE_ADMIN === $mode) {
$session = Auth::decodeSession(
$request->getCookie(Auth::$cookieName, // Get sessions
$request->getCookie(Auth::$cookieName.'_legacy', // Get fallback session from old clients (no SameSite support)
- $request->getHeader('X-Appwrite-Key', '')))); // Get API Key
+ $request->getHeader('X-Appwrite-Key', '')))); // Get API Key
// Get fallback session from clients who block 3rd-party cookies
$response->addHeader('X-Debug-Fallback', 'false');
diff --git a/app/sdks/flutter-dart/CHANGELOG.md b/app/sdks/client-flutter/CHANGELOG.md
similarity index 52%
rename from app/sdks/flutter-dart/CHANGELOG.md
rename to app/sdks/client-flutter/CHANGELOG.md
index fe50409674..37f6a30a69 100644
--- a/app/sdks/flutter-dart/CHANGELOG.md
+++ b/app/sdks/client-flutter/CHANGELOG.md
@@ -1,3 +1,17 @@
+## 0.2.2
+
+- Fixed an error that happend when the OAuth session creation request was sent before any other API call
+- Fixed a bug in the Avatars service where location URL generation had syntax error
+
+## 0.2.1
+
+- Fixed callback scheme
+
+## 0.2.0
+
+- Updated flutter_web_auth plugin to version 0.2.4
+- Added per project unique callback for OAuth2 redirects to aviod conflicts between multiple Appwrite projects
+
## 0.1.1
- Updated flutter_web_auth version
diff --git a/app/sdks/console-javascript/LICENSE b/app/sdks/client-flutter/LICENSE
similarity index 100%
rename from app/sdks/console-javascript/LICENSE
rename to app/sdks/client-flutter/LICENSE
diff --git a/app/sdks/flutter-dart/README.md b/app/sdks/client-flutter/README.md
similarity index 78%
rename from app/sdks/flutter-dart/README.md
rename to app/sdks/client-flutter/README.md
index 7c84ddd863..b0c261c115 100644
--- a/app/sdks/flutter-dart/README.md
+++ b/app/sdks/client-flutter/README.md
@@ -1,13 +1,13 @@
-# Appwrite SDK for Dart
+# Appwrite Flutter SDK
[](https://pub.dartlang.org/packages/appwrite)
-
-
+
+
-**This SDK is compatible with Appwrite server version 0.5.3. For older versions, please check previous releases.**
+**This SDK is compatible with Appwrite server version 0.6.1. For older versions, please check previous releases.**
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
- Use the Dart SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
+ Use the Flutter SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
@@ -20,7 +20,7 @@ Add this to your package's `pubspec.yaml` file:
```yml
dependencies:
- appwrite: ^0.1.1
+ appwrite: ^0.2.2
```
You can install packages from the command line:
diff --git a/app/sdks/client-flutter/docs/examples/account/create-o-auth2session.md b/app/sdks/client-flutter/docs/examples/account/create-o-auth2session.md
new file mode 100644
index 0000000000..c617c34d4d
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/create-o-auth2session.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.createOAuth2Session(
+ provider: 'bitbucket',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/create-recovery.md b/app/sdks/client-flutter/docs/examples/account/create-recovery.md
new file mode 100644
index 0000000000..50db45b15d
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/create-recovery.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.createRecovery(
+ email: 'email@example.com',
+ url: 'https://example.com',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/create-session.md b/app/sdks/client-flutter/docs/examples/account/create-session.md
new file mode 100644
index 0000000000..ef824b4eca
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/create-session.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.createSession(
+ email: 'email@example.com',
+ password: 'password',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/create-verification.md b/app/sdks/client-flutter/docs/examples/account/create-verification.md
new file mode 100644
index 0000000000..6b9b1ace40
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/create-verification.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.createVerification(
+ url: 'https://example.com',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/create.md b/app/sdks/client-flutter/docs/examples/account/create.md
new file mode 100644
index 0000000000..384258ae68
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/create.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.create(
+ email: 'email@example.com',
+ password: 'password',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/delete-session.md b/app/sdks/client-flutter/docs/examples/account/delete-session.md
new file mode 100644
index 0000000000..80a3f505d0
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/delete-session.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.deleteSession(
+ sessionId: '[SESSION_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/delete-sessions.md b/app/sdks/client-flutter/docs/examples/account/delete-sessions.md
new file mode 100644
index 0000000000..5e947fabc2
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/delete-sessions.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.deleteSessions( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/delete.md b/app/sdks/client-flutter/docs/examples/account/delete.md
new file mode 100644
index 0000000000..2853a1f437
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/delete.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.delete( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/get-logs.md b/app/sdks/client-flutter/docs/examples/account/get-logs.md
new file mode 100644
index 0000000000..8f52f8220b
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/get-logs.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.getLogs( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/get-prefs.md b/app/sdks/client-flutter/docs/examples/account/get-prefs.md
new file mode 100644
index 0000000000..01d57a5499
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/get-prefs.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.getPrefs( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/get-sessions.md b/app/sdks/client-flutter/docs/examples/account/get-sessions.md
new file mode 100644
index 0000000000..e921bda59b
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/get-sessions.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.getSessions( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/get.md b/app/sdks/client-flutter/docs/examples/account/get.md
new file mode 100644
index 0000000000..35241b5607
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/get.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.get( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/update-email.md b/app/sdks/client-flutter/docs/examples/account/update-email.md
new file mode 100644
index 0000000000..4a1a002db4
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/update-email.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.updateEmail(
+ email: 'email@example.com',
+ password: 'password',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/update-name.md b/app/sdks/client-flutter/docs/examples/account/update-name.md
new file mode 100644
index 0000000000..fa432bb34a
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/update-name.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.updateName(
+ name: '[NAME]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/update-password.md b/app/sdks/client-flutter/docs/examples/account/update-password.md
new file mode 100644
index 0000000000..9bd8ad9b77
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/update-password.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.updatePassword(
+ password: 'password',
+ oldPassword: 'password',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/update-prefs.md b/app/sdks/client-flutter/docs/examples/account/update-prefs.md
new file mode 100644
index 0000000000..443252f89a
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/update-prefs.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.updatePrefs(
+ prefs: {},
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/update-recovery.md b/app/sdks/client-flutter/docs/examples/account/update-recovery.md
new file mode 100644
index 0000000000..5140235d49
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/update-recovery.md
@@ -0,0 +1,25 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.updateRecovery(
+ userId: '[USER_ID]',
+ secret: '[SECRET]',
+ password: 'password',
+ passwordAgain: 'password',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/account/update-verification.md b/app/sdks/client-flutter/docs/examples/account/update-verification.md
new file mode 100644
index 0000000000..b795cde92d
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/account/update-verification.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Account account = Account(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = account.updateVerification(
+ userId: '[USER_ID]',
+ secret: '[SECRET]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/avatars/get-browser.md b/app/sdks/client-flutter/docs/examples/avatars/get-browser.md
new file mode 100644
index 0000000000..464767c4c0
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/avatars/get-browser.md
@@ -0,0 +1,17 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Avatars avatars = Avatars(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ String result = avatars.getBrowser(
+ code: 'aa',
+ );
+
+ print(result); // Resource URL string
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/avatars/get-credit-card.md b/app/sdks/client-flutter/docs/examples/avatars/get-credit-card.md
new file mode 100644
index 0000000000..482c642402
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/avatars/get-credit-card.md
@@ -0,0 +1,17 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Avatars avatars = Avatars(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ String result = avatars.getCreditCard(
+ code: 'amex',
+ );
+
+ print(result); // Resource URL string
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/avatars/get-favicon.md b/app/sdks/client-flutter/docs/examples/avatars/get-favicon.md
new file mode 100644
index 0000000000..60397b0af2
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/avatars/get-favicon.md
@@ -0,0 +1,17 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Avatars avatars = Avatars(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ String result = avatars.getFavicon(
+ url: 'https://example.com',
+ );
+
+ print(result); // Resource URL string
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/avatars/get-flag.md b/app/sdks/client-flutter/docs/examples/avatars/get-flag.md
new file mode 100644
index 0000000000..a9f7a711d9
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/avatars/get-flag.md
@@ -0,0 +1,17 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Avatars avatars = Avatars(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ String result = avatars.getFlag(
+ code: 'af',
+ );
+
+ print(result); // Resource URL string
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/avatars/get-image.md b/app/sdks/client-flutter/docs/examples/avatars/get-image.md
new file mode 100644
index 0000000000..7cead1cb2f
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/avatars/get-image.md
@@ -0,0 +1,17 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Avatars avatars = Avatars(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ String result = avatars.getImage(
+ url: 'https://example.com',
+ );
+
+ print(result); // Resource URL string
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/avatars/get-q-r.md b/app/sdks/client-flutter/docs/examples/avatars/get-q-r.md
new file mode 100644
index 0000000000..a5bcfd2c05
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/avatars/get-q-r.md
@@ -0,0 +1,17 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Avatars avatars = Avatars(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ String result = avatars.getQR(
+ text: '[TEXT]',
+ );
+
+ print(result); // Resource URL string
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/database/create-document.md b/app/sdks/client-flutter/docs/examples/database/create-document.md
new file mode 100644
index 0000000000..b7d540bc2d
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/database/create-document.md
@@ -0,0 +1,25 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Database database = Database(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = database.createDocument(
+ collectionId: '[COLLECTION_ID]',
+ data: {},
+ read: [],
+ write: [],
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/database/delete-document.md b/app/sdks/client-flutter/docs/examples/database/delete-document.md
new file mode 100644
index 0000000000..40c1cbdfe2
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/database/delete-document.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Database database = Database(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = database.deleteDocument(
+ collectionId: '[COLLECTION_ID]',
+ documentId: '[DOCUMENT_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/database/get-document.md b/app/sdks/client-flutter/docs/examples/database/get-document.md
new file mode 100644
index 0000000000..0c98142315
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/database/get-document.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Database database = Database(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = database.getDocument(
+ collectionId: '[COLLECTION_ID]',
+ documentId: '[DOCUMENT_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/database/list-documents.md b/app/sdks/client-flutter/docs/examples/database/list-documents.md
new file mode 100644
index 0000000000..0685e7f1aa
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/database/list-documents.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Database database = Database(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = database.listDocuments(
+ collectionId: '[COLLECTION_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/database/update-document.md b/app/sdks/client-flutter/docs/examples/database/update-document.md
new file mode 100644
index 0000000000..2f37cd767a
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/database/update-document.md
@@ -0,0 +1,26 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Database database = Database(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = database.updateDocument(
+ collectionId: '[COLLECTION_ID]',
+ documentId: '[DOCUMENT_ID]',
+ data: {},
+ read: [],
+ write: [],
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/locale/get-continents.md b/app/sdks/client-flutter/docs/examples/locale/get-continents.md
new file mode 100644
index 0000000000..2a6a6413ba
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/locale/get-continents.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Locale locale = Locale(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = locale.getContinents( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/locale/get-countries-e-u.md b/app/sdks/client-flutter/docs/examples/locale/get-countries-e-u.md
new file mode 100644
index 0000000000..1934fc6709
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/locale/get-countries-e-u.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Locale locale = Locale(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = locale.getCountriesEU( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/locale/get-countries-phones.md b/app/sdks/client-flutter/docs/examples/locale/get-countries-phones.md
new file mode 100644
index 0000000000..f6b1f58749
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/locale/get-countries-phones.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Locale locale = Locale(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = locale.getCountriesPhones( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/locale/get-countries.md b/app/sdks/client-flutter/docs/examples/locale/get-countries.md
new file mode 100644
index 0000000000..104584968f
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/locale/get-countries.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Locale locale = Locale(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = locale.getCountries( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/locale/get-currencies.md b/app/sdks/client-flutter/docs/examples/locale/get-currencies.md
new file mode 100644
index 0000000000..8dc01fc68e
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/locale/get-currencies.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Locale locale = Locale(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = locale.getCurrencies( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/locale/get.md b/app/sdks/client-flutter/docs/examples/locale/get.md
new file mode 100644
index 0000000000..189fceb7d1
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/locale/get.md
@@ -0,0 +1,20 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Locale locale = Locale(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = locale.get( );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/storage/create-file.md b/app/sdks/client-flutter/docs/examples/storage/create-file.md
new file mode 100644
index 0000000000..9f61be12f4
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/storage/create-file.md
@@ -0,0 +1,25 @@
+import 'dart:io';
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Storage storage = Storage(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = storage.createFile(
+ file: await MultipartFile.fromFile('./path-to-files/image.jpg', 'image.jpg'),
+ read: [],
+ write: [],
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/storage/delete-file.md b/app/sdks/client-flutter/docs/examples/storage/delete-file.md
new file mode 100644
index 0000000000..271ed7b2dd
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/storage/delete-file.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Storage storage = Storage(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = storage.deleteFile(
+ fileId: '[FILE_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/storage/get-file-download.md b/app/sdks/client-flutter/docs/examples/storage/get-file-download.md
new file mode 100644
index 0000000000..be3385a61b
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/storage/get-file-download.md
@@ -0,0 +1,17 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Storage storage = Storage(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ String result = storage.getFileDownload(
+ fileId: '[FILE_ID]',
+ );
+
+ print(result); // Resource URL string
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/storage/get-file-preview.md b/app/sdks/client-flutter/docs/examples/storage/get-file-preview.md
new file mode 100644
index 0000000000..8bd1a47457
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/storage/get-file-preview.md
@@ -0,0 +1,17 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Storage storage = Storage(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ String result = storage.getFilePreview(
+ fileId: '[FILE_ID]',
+ );
+
+ print(result); // Resource URL string
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/storage/get-file-view.md b/app/sdks/client-flutter/docs/examples/storage/get-file-view.md
new file mode 100644
index 0000000000..5803fd409f
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/storage/get-file-view.md
@@ -0,0 +1,17 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Storage storage = Storage(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ String result = storage.getFileView(
+ fileId: '[FILE_ID]',
+ );
+
+ print(result); // Resource URL string
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/storage/get-file.md b/app/sdks/client-flutter/docs/examples/storage/get-file.md
new file mode 100644
index 0000000000..feca667fa9
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/storage/get-file.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Storage storage = Storage(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = storage.getFile(
+ fileId: '[FILE_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/storage/list-files.md b/app/sdks/client-flutter/docs/examples/storage/list-files.md
new file mode 100644
index 0000000000..1963ec694d
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/storage/list-files.md
@@ -0,0 +1,21 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Storage storage = Storage(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = storage.listFiles(
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/storage/update-file.md b/app/sdks/client-flutter/docs/examples/storage/update-file.md
new file mode 100644
index 0000000000..a5ecbfe987
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/storage/update-file.md
@@ -0,0 +1,24 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Storage storage = Storage(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = storage.updateFile(
+ fileId: '[FILE_ID]',
+ read: [],
+ write: [],
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/teams/create-membership.md b/app/sdks/client-flutter/docs/examples/teams/create-membership.md
new file mode 100644
index 0000000000..e5e82de7b4
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/teams/create-membership.md
@@ -0,0 +1,25 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Teams teams = Teams(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = teams.createMembership(
+ teamId: '[TEAM_ID]',
+ email: 'email@example.com',
+ roles: [],
+ url: 'https://example.com',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/teams/create.md b/app/sdks/client-flutter/docs/examples/teams/create.md
new file mode 100644
index 0000000000..d11958ae6d
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/teams/create.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Teams teams = Teams(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = teams.create(
+ name: '[NAME]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/teams/delete-membership.md b/app/sdks/client-flutter/docs/examples/teams/delete-membership.md
new file mode 100644
index 0000000000..3f57b840fe
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/teams/delete-membership.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Teams teams = Teams(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = teams.deleteMembership(
+ teamId: '[TEAM_ID]',
+ inviteId: '[INVITE_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/teams/delete.md b/app/sdks/client-flutter/docs/examples/teams/delete.md
new file mode 100644
index 0000000000..9fb488afec
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/teams/delete.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Teams teams = Teams(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = teams.delete(
+ teamId: '[TEAM_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/teams/get-memberships.md b/app/sdks/client-flutter/docs/examples/teams/get-memberships.md
new file mode 100644
index 0000000000..4edadfa2b4
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/teams/get-memberships.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Teams teams = Teams(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = teams.getMemberships(
+ teamId: '[TEAM_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/teams/get.md b/app/sdks/client-flutter/docs/examples/teams/get.md
new file mode 100644
index 0000000000..083565f7a6
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/teams/get.md
@@ -0,0 +1,22 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Teams teams = Teams(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = teams.get(
+ teamId: '[TEAM_ID]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/teams/list.md b/app/sdks/client-flutter/docs/examples/teams/list.md
new file mode 100644
index 0000000000..665020e928
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/teams/list.md
@@ -0,0 +1,21 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Teams teams = Teams(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = teams.list(
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/teams/update-membership-status.md b/app/sdks/client-flutter/docs/examples/teams/update-membership-status.md
new file mode 100644
index 0000000000..616f64e148
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/teams/update-membership-status.md
@@ -0,0 +1,25 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Teams teams = Teams(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = teams.updateMembershipStatus(
+ teamId: '[TEAM_ID]',
+ inviteId: '[INVITE_ID]',
+ userId: '[USER_ID]',
+ secret: '[SECRET]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/client-flutter/docs/examples/teams/update.md b/app/sdks/client-flutter/docs/examples/teams/update.md
new file mode 100644
index 0000000000..915fb57d38
--- /dev/null
+++ b/app/sdks/client-flutter/docs/examples/teams/update.md
@@ -0,0 +1,23 @@
+import 'package:appwrite/appwrite.dart';
+
+void main() { // Init SDK
+ Client client = Client();
+ Teams teams = Teams(client);
+
+ client
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+ ;
+
+ Future result = teams.update(
+ teamId: '[TEAM_ID]',
+ name: '[NAME]',
+ );
+
+ result
+ .then((response) {
+ print(response);
+ }).catchError((error) {
+ print(error.response);
+ });
+}
\ No newline at end of file
diff --git a/app/sdks/flutter-dart/example/README.md b/app/sdks/client-flutter/example/README.md
similarity index 100%
rename from app/sdks/flutter-dart/example/README.md
rename to app/sdks/client-flutter/example/README.md
diff --git a/app/sdks/flutter-dart/lib/appwrite.dart b/app/sdks/client-flutter/lib/appwrite.dart
similarity index 100%
rename from app/sdks/flutter-dart/lib/appwrite.dart
rename to app/sdks/client-flutter/lib/appwrite.dart
diff --git a/app/sdks/flutter-dart/lib/client.dart b/app/sdks/client-flutter/lib/client.dart
similarity index 83%
rename from app/sdks/flutter-dart/lib/client.dart
rename to app/sdks/client-flutter/lib/client.dart
index 90eb0bd6fe..d9e8eedf19 100644
--- a/app/sdks/flutter-dart/lib/client.dart
+++ b/app/sdks/client-flutter/lib/client.dart
@@ -15,7 +15,7 @@ class Client {
Map headers;
Map config;
bool selfSigned;
- bool init = false;
+ bool initialized = false;
Dio http;
PersistCookieJar cookieJar;
@@ -30,7 +30,7 @@ class Client {
this.headers = {
'content-type': 'application/json',
- 'x-sdk-version': 'appwrite:dart:0.1.1',
+ 'x-sdk-version': 'appwrite:dart:0.2.2',
};
this.config = {};
@@ -76,6 +76,22 @@ class Client {
return this;
}
+ Future init() async {
+ if(!initialized) {
+ final Directory cookieDir = await _getCookiePath();
+
+ cookieJar = new PersistCookieJar(dir:cookieDir.path);
+
+ this.http.options.baseUrl = this.endPoint;
+ this.http.options.validateStatus = (status) => status < 400;
+ this.http.interceptors.add(CookieManager(cookieJar));
+
+ PackageInfo packageInfo = await PackageInfo.fromPlatform();
+
+ addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName);
+ }
+ }
+
Future call(HttpMethod method, {String path = '', Map headers = const {}, Map params = const {}}) async {
if(selfSigned) {
// Allow self signed requests
@@ -85,21 +101,7 @@ class Client {
};
}
- if(!init) {
- final Directory cookieDir = await _getCookiePath();
-
- cookieJar = new PersistCookieJar(dir:cookieDir.path);
-
- this.http.options.baseUrl = this.endPoint;
- this.http.options.validateStatus = (status) => status < 400;
- this.http.interceptors.add(CookieManager(cookieJar));
-
- PackageInfo packageInfo = await PackageInfo.fromPlatform();
-
- addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName);
-
- init = true;
- }
+ await this.init();
// Origin is hardcoded for testing
Options options = Options(
diff --git a/app/sdks/flutter-dart/lib/enums.dart b/app/sdks/client-flutter/lib/enums.dart
similarity index 100%
rename from app/sdks/flutter-dart/lib/enums.dart
rename to app/sdks/client-flutter/lib/enums.dart
diff --git a/app/sdks/flutter-dart/lib/service.dart b/app/sdks/client-flutter/lib/service.dart
similarity index 100%
rename from app/sdks/flutter-dart/lib/service.dart
rename to app/sdks/client-flutter/lib/service.dart
diff --git a/app/sdks/flutter-dart/lib/services/account.dart b/app/sdks/client-flutter/lib/services/account.dart
similarity index 98%
rename from app/sdks/flutter-dart/lib/services/account.dart
rename to app/sdks/client-flutter/lib/services/account.dart
index 92951ce5cf..8cc237d104 100644
--- a/app/sdks/flutter-dart/lib/services/account.dart
+++ b/app/sdks/client-flutter/lib/services/account.dart
@@ -305,7 +305,7 @@ class Account extends Service {
/// first. Use the success and failure arguments to provide a redirect URL's
/// back to your app when login is completed.
///
- Future createOAuth2Session({@required String provider, String success = 'https://localhost:2444/auth/oauth2/success', String failure = 'https://localhost:2444/auth/oauth2/failure'}) {
+ Future createOAuth2Session({@required String provider, String success = 'https://appwrite.io/auth/oauth2/success', String failure = 'https://appwrite.io/auth/oauth2/failure'}) {
final String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider);
final Map params = {
@@ -324,10 +324,11 @@ class Account extends Service {
return FlutterWebAuth.authenticate(
url: url.toString(),
- callbackUrlScheme: "appwrite-callback"
- ).then((value) {
+ callbackUrlScheme: "appwrite-callback-" + client.config['project']
+ ).then((value) async {
Uri url = Uri.parse(value);
List cookies = [new Cookie(url.queryParameters['key'], url.queryParameters['secret'])];
+ await client.init();
client.cookieJar.saveFromResponse(Uri.parse(client.endPoint), cookies);
});
}
diff --git a/app/sdks/flutter-dart/lib/services/avatars.dart b/app/sdks/client-flutter/lib/services/avatars.dart
similarity index 55%
rename from app/sdks/flutter-dart/lib/services/avatars.dart
rename to app/sdks/client-flutter/lib/services/avatars.dart
index a85b667018..fc9c403d90 100644
--- a/app/sdks/flutter-dart/lib/services/avatars.dart
+++ b/app/sdks/client-flutter/lib/services/avatars.dart
@@ -17,20 +17,25 @@ class Avatars extends Service {
/// /account/sessions endpoint. Use width, height and quality arguments to
/// change the output settings.
///
- Future getBrowser({@required String code, int width = 100, int height = 100, int quality = 100}) {
+ String getBrowser({@required String code, int width = 100, int height = 100, int quality = 100}) {
final String path = '/avatars/browsers/{code}'.replaceAll(RegExp('{code}'), code);
final Map params = {
'width': width,
'height': height,
'quality': quality,
+ 'project': client.config['project'],
};
- final Map headers = {
- 'content-type': 'application/json',
- };
+ Uri endpoint = Uri.parse(client.endPoint);
+ Uri location = new Uri(scheme: endpoint.scheme,
+ host: endpoint.host,
+ port: endpoint.port,
+ path: endpoint.path + path,
+ queryParameters:params,
+ );
- return client.call(HttpMethod.get, path: path, params: params, headers: headers);
+ return location.toString();
}
/// Get Credit Card Icon
@@ -40,20 +45,25 @@ class Avatars extends Service {
/// card provider you need. Use width, height and quality arguments to change
/// the output settings.
///
- Future getCreditCard({@required String code, int width = 100, int height = 100, int quality = 100}) {
+ String getCreditCard({@required String code, int width = 100, int height = 100, int quality = 100}) {
final String path = '/avatars/credit-cards/{code}'.replaceAll(RegExp('{code}'), code);
final Map params = {
'width': width,
'height': height,
'quality': quality,
+ 'project': client.config['project'],
};
- final Map headers = {
- 'content-type': 'application/json',
- };
+ Uri endpoint = Uri.parse(client.endPoint);
+ Uri location = new Uri(scheme: endpoint.scheme,
+ host: endpoint.host,
+ port: endpoint.port,
+ path: endpoint.path + path,
+ queryParameters:params,
+ );
- return client.call(HttpMethod.get, path: path, params: params, headers: headers);
+ return location.toString();
}
/// Get Favicon
@@ -61,18 +71,23 @@ class Avatars extends Service {
/// Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote
/// website URL.
///
- Future getFavicon({@required String url}) {
+ String getFavicon({@required String url}) {
final String path = '/avatars/favicon';
final Map params = {
'url': url,
+ 'project': client.config['project'],
};
- final Map headers = {
- 'content-type': 'application/json',
- };
+ Uri endpoint = Uri.parse(client.endPoint);
+ Uri location = new Uri(scheme: endpoint.scheme,
+ host: endpoint.host,
+ port: endpoint.port,
+ path: endpoint.path + path,
+ queryParameters:params,
+ );
- return client.call(HttpMethod.get, path: path, params: params, headers: headers);
+ return location.toString();
}
/// Get Country Flag
@@ -81,20 +96,25 @@ class Avatars extends Service {
/// users. The code argument receives the 2 letter country code. Use width,
/// height and quality arguments to change the output settings.
///
- Future getFlag({@required String code, int width = 100, int height = 100, int quality = 100}) {
+ String getFlag({@required String code, int width = 100, int height = 100, int quality = 100}) {
final String path = '/avatars/flags/{code}'.replaceAll(RegExp('{code}'), code);
final Map params = {
'width': width,
'height': height,
'quality': quality,
+ 'project': client.config['project'],
};
- final Map headers = {
- 'content-type': 'application/json',
- };
+ Uri endpoint = Uri.parse(client.endPoint);
+ Uri location = new Uri(scheme: endpoint.scheme,
+ host: endpoint.host,
+ port: endpoint.port,
+ path: endpoint.path + path,
+ queryParameters:params,
+ );
- return client.call(HttpMethod.get, path: path, params: params, headers: headers);
+ return location.toString();
}
/// Get Image from URL
@@ -104,20 +124,25 @@ class Avatars extends Service {
/// remote images in your app or in case you want to make sure a 3rd party
/// image is properly served using a TLS protocol.
///
- Future getImage({@required String url, int width = 400, int height = 400}) {
+ String getImage({@required String url, int width = 400, int height = 400}) {
final String path = '/avatars/image';
final Map params = {
'url': url,
'width': width,
'height': height,
+ 'project': client.config['project'],
};
- final Map headers = {
- 'content-type': 'application/json',
- };
+ Uri endpoint = Uri.parse(client.endPoint);
+ Uri location = new Uri(scheme: endpoint.scheme,
+ host: endpoint.host,
+ port: endpoint.port,
+ path: endpoint.path + path,
+ queryParameters:params,
+ );
- return client.call(HttpMethod.get, path: path, params: params, headers: headers);
+ return location.toString();
}
/// Get QR Code
@@ -125,7 +150,7 @@ class Avatars extends Service {
/// Converts a given plain text to a QR code image. You can use the query
/// parameters to change the size and style of the resulting image.
///
- Future getQR({@required String text, int size = 400, int margin = 1, int download = 0}) {
+ String getQR({@required String text, int size = 400, int margin = 1, int download = 0}) {
final String path = '/avatars/qr';
final Map params = {
@@ -133,12 +158,17 @@ class Avatars extends Service {
'size': size,
'margin': margin,
'download': download,
+ 'project': client.config['project'],
};
- final Map headers = {
- 'content-type': 'application/json',
- };
+ Uri endpoint = Uri.parse(client.endPoint);
+ Uri location = new Uri(scheme: endpoint.scheme,
+ host: endpoint.host,
+ port: endpoint.port,
+ path: endpoint.path + path,
+ queryParameters:params,
+ );
- return client.call(HttpMethod.get, path: path, params: params, headers: headers);
+ return location.toString();
}
}
\ No newline at end of file
diff --git a/app/sdks/flutter-dart/lib/services/database.dart b/app/sdks/client-flutter/lib/services/database.dart
similarity index 100%
rename from app/sdks/flutter-dart/lib/services/database.dart
rename to app/sdks/client-flutter/lib/services/database.dart
diff --git a/app/sdks/flutter-dart/lib/services/locale.dart b/app/sdks/client-flutter/lib/services/locale.dart
similarity index 100%
rename from app/sdks/flutter-dart/lib/services/locale.dart
rename to app/sdks/client-flutter/lib/services/locale.dart
diff --git a/app/sdks/flutter-dart/lib/services/storage.dart b/app/sdks/client-flutter/lib/services/storage.dart
similarity index 95%
rename from app/sdks/flutter-dart/lib/services/storage.dart
rename to app/sdks/client-flutter/lib/services/storage.dart
index 47497c7699..696c15ee3a 100644
--- a/app/sdks/flutter-dart/lib/services/storage.dart
+++ b/app/sdks/client-flutter/lib/services/storage.dart
@@ -125,14 +125,14 @@ class Storage extends Service {
};
Uri endpoint = Uri.parse(client.endPoint);
- Uri url = new Uri(scheme: endpoint.scheme,
+ Uri location = new Uri(scheme: endpoint.scheme,
host: endpoint.host,
port: endpoint.port,
path: endpoint.path + path,
queryParameters:params,
);
- return url.toString();
+ return location.toString();
}
/// Get File Preview
@@ -155,14 +155,14 @@ class Storage extends Service {
};
Uri endpoint = Uri.parse(client.endPoint);
- Uri url = new Uri(scheme: endpoint.scheme,
+ Uri location = new Uri(scheme: endpoint.scheme,
host: endpoint.host,
port: endpoint.port,
path: endpoint.path + path,
queryParameters:params,
);
- return url.toString();
+ return location.toString();
}
/// Get File for View
@@ -179,13 +179,13 @@ class Storage extends Service {
};
Uri endpoint = Uri.parse(client.endPoint);
- Uri url = new Uri(scheme: endpoint.scheme,
+ Uri location = new Uri(scheme: endpoint.scheme,
host: endpoint.host,
port: endpoint.port,
path: endpoint.path + path,
queryParameters:params,
);
- return url.toString();
+ return location.toString();
}
}
\ No newline at end of file
diff --git a/app/sdks/flutter-dart/lib/services/teams.dart b/app/sdks/client-flutter/lib/services/teams.dart
similarity index 100%
rename from app/sdks/flutter-dart/lib/services/teams.dart
rename to app/sdks/client-flutter/lib/services/teams.dart
diff --git a/app/sdks/flutter-dart/pubspec.yaml b/app/sdks/client-flutter/pubspec.yaml
similarity index 91%
rename from app/sdks/flutter-dart/pubspec.yaml
rename to app/sdks/client-flutter/pubspec.yaml
index 33c49e6a9c..2954cdb9e9 100644
--- a/app/sdks/flutter-dart/pubspec.yaml
+++ b/app/sdks/client-flutter/pubspec.yaml
@@ -1,8 +1,8 @@
name: appwrite
-version: 0.1.1
+version: 0.2.2
description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API
homepage: https://appwrite.io
-repository: https://github.com/appwrite/sdk-for-dart
+repository: https://github.com/appwrite/sdk-for-flutter
issue_tracker: https://github.com/appwrite/sdk-generator/issues
documentation: https://appwrite.io/support
environment:
@@ -14,7 +14,7 @@ dependencies:
dio: ^3.0.0
cookie_jar: ^1.0.0
dio_cookie_manager: ^1.0.0
- flutter_web_auth: ^0.2.0
+ flutter_web_auth: ^0.2.4
flutter:
sdk: flutter
diff --git a/app/sdks/console-javascript/CHANGELOG.md b/app/sdks/client-web/CHANGELOG.md
similarity index 100%
rename from app/sdks/console-javascript/CHANGELOG.md
rename to app/sdks/client-web/CHANGELOG.md
diff --git a/app/sdks/flutter-dart/LICENSE b/app/sdks/client-web/LICENSE
similarity index 100%
rename from app/sdks/flutter-dart/LICENSE
rename to app/sdks/client-web/LICENSE
diff --git a/app/sdks/web-javascript/README.md b/app/sdks/client-web/README.md
similarity index 69%
rename from app/sdks/web-javascript/README.md
rename to app/sdks/client-web/README.md
index 812e31fd29..e59480b4a9 100644
--- a/app/sdks/web-javascript/README.md
+++ b/app/sdks/client-web/README.md
@@ -1,10 +1,10 @@
-# Appwrite SDK for JavaScript
+# Appwrite Web SDK

-
+
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way.
- Use the JavaScript SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
+ Use the Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools.
For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)

@@ -30,24 +30,9 @@ import * as Appwrite from "appwrite";
To install with a CDN (content delivery network) add the following scripts to the bottom of your tag, but before you use any Appwrite services:
```html
-
+
```
-## Getting Started
-
-Initialise the Appwrite SDK in your code, and setup your API credentials:
-
-```js
-
-// Init your JS SDK
-var appwrite = new Appwrite();
-
-appwrite
- .setEndpoint('http://localhost/v1') // Set only when using self-hosted solution
- .setProject('455x34dfkj') // Your Appwrite Project UID
-;
-
-```
## Contribution
diff --git a/app/sdks/web-javascript/docs/examples/account/create-o-auth2session.md b/app/sdks/client-web/docs/examples/account/create-o-auth2session.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/account/create-o-auth2session.md
rename to app/sdks/client-web/docs/examples/account/create-o-auth2session.md
index 611df2173d..5cc825a273 100644
--- a/app/sdks/web-javascript/docs/examples/account/create-o-auth2session.md
+++ b/app/sdks/client-web/docs/examples/account/create-o-auth2session.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/create-recovery.md b/app/sdks/client-web/docs/examples/account/create-recovery.md
similarity index 81%
rename from app/sdks/web-javascript/docs/examples/account/create-recovery.md
rename to app/sdks/client-web/docs/examples/account/create-recovery.md
index 0647f3e468..72130f4de4 100644
--- a/app/sdks/web-javascript/docs/examples/account/create-recovery.md
+++ b/app/sdks/client-web/docs/examples/account/create-recovery.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/create-session.md b/app/sdks/client-web/docs/examples/account/create-session.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/account/create-session.md
rename to app/sdks/client-web/docs/examples/account/create-session.md
index 1a02c4c131..4a7682c13d 100644
--- a/app/sdks/web-javascript/docs/examples/account/create-session.md
+++ b/app/sdks/client-web/docs/examples/account/create-session.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/create-verification.md b/app/sdks/client-web/docs/examples/account/create-verification.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/account/create-verification.md
rename to app/sdks/client-web/docs/examples/account/create-verification.md
index 69488635f4..7903384a9f 100644
--- a/app/sdks/web-javascript/docs/examples/account/create-verification.md
+++ b/app/sdks/client-web/docs/examples/account/create-verification.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/create.md b/app/sdks/client-web/docs/examples/account/create.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/account/create.md
rename to app/sdks/client-web/docs/examples/account/create.md
index fb6e235aa3..c9ce798b6a 100644
--- a/app/sdks/web-javascript/docs/examples/account/create.md
+++ b/app/sdks/client-web/docs/examples/account/create.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/delete-session.md b/app/sdks/client-web/docs/examples/account/delete-session.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/account/delete-session.md
rename to app/sdks/client-web/docs/examples/account/delete-session.md
index 598c9269ec..581e5d132d 100644
--- a/app/sdks/web-javascript/docs/examples/account/delete-session.md
+++ b/app/sdks/client-web/docs/examples/account/delete-session.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/delete-sessions.md b/app/sdks/client-web/docs/examples/account/delete-sessions.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/account/delete-sessions.md
rename to app/sdks/client-web/docs/examples/account/delete-sessions.md
index 7c988afa33..d037673eb3 100644
--- a/app/sdks/web-javascript/docs/examples/account/delete-sessions.md
+++ b/app/sdks/client-web/docs/examples/account/delete-sessions.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/delete.md b/app/sdks/client-web/docs/examples/account/delete.md
similarity index 78%
rename from app/sdks/web-javascript/docs/examples/account/delete.md
rename to app/sdks/client-web/docs/examples/account/delete.md
index 2679c444b0..d952d77d7a 100644
--- a/app/sdks/web-javascript/docs/examples/account/delete.md
+++ b/app/sdks/client-web/docs/examples/account/delete.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/get-logs.md b/app/sdks/client-web/docs/examples/account/get-logs.md
similarity index 78%
rename from app/sdks/web-javascript/docs/examples/account/get-logs.md
rename to app/sdks/client-web/docs/examples/account/get-logs.md
index b1234e1929..c53e0446e9 100644
--- a/app/sdks/web-javascript/docs/examples/account/get-logs.md
+++ b/app/sdks/client-web/docs/examples/account/get-logs.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/get-prefs.md b/app/sdks/client-web/docs/examples/account/get-prefs.md
similarity index 78%
rename from app/sdks/web-javascript/docs/examples/account/get-prefs.md
rename to app/sdks/client-web/docs/examples/account/get-prefs.md
index 7e9a1df84f..75835e37fb 100644
--- a/app/sdks/web-javascript/docs/examples/account/get-prefs.md
+++ b/app/sdks/client-web/docs/examples/account/get-prefs.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/get-sessions.md b/app/sdks/client-web/docs/examples/account/get-sessions.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/account/get-sessions.md
rename to app/sdks/client-web/docs/examples/account/get-sessions.md
index 96eefa6422..b4434de336 100644
--- a/app/sdks/web-javascript/docs/examples/account/get-sessions.md
+++ b/app/sdks/client-web/docs/examples/account/get-sessions.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/get.md b/app/sdks/client-web/docs/examples/account/get.md
similarity index 78%
rename from app/sdks/web-javascript/docs/examples/account/get.md
rename to app/sdks/client-web/docs/examples/account/get.md
index 0a0c7a2ccc..f0184a8513 100644
--- a/app/sdks/web-javascript/docs/examples/account/get.md
+++ b/app/sdks/client-web/docs/examples/account/get.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/update-email.md b/app/sdks/client-web/docs/examples/account/update-email.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/account/update-email.md
rename to app/sdks/client-web/docs/examples/account/update-email.md
index 4beeeb8cf8..f48fed78bc 100644
--- a/app/sdks/web-javascript/docs/examples/account/update-email.md
+++ b/app/sdks/client-web/docs/examples/account/update-email.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/update-name.md b/app/sdks/client-web/docs/examples/account/update-name.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/account/update-name.md
rename to app/sdks/client-web/docs/examples/account/update-name.md
index 0464d29405..e03e72c4b2 100644
--- a/app/sdks/web-javascript/docs/examples/account/update-name.md
+++ b/app/sdks/client-web/docs/examples/account/update-name.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/update-password.md b/app/sdks/client-web/docs/examples/account/update-password.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/account/update-password.md
rename to app/sdks/client-web/docs/examples/account/update-password.md
index 14180f4b5b..22539f3f64 100644
--- a/app/sdks/web-javascript/docs/examples/account/update-password.md
+++ b/app/sdks/client-web/docs/examples/account/update-password.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/update-prefs.md b/app/sdks/client-web/docs/examples/account/update-prefs.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/account/update-prefs.md
rename to app/sdks/client-web/docs/examples/account/update-prefs.md
index 0e7d005134..b2d4ff175e 100644
--- a/app/sdks/web-javascript/docs/examples/account/update-prefs.md
+++ b/app/sdks/client-web/docs/examples/account/update-prefs.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/update-recovery.md b/app/sdks/client-web/docs/examples/account/update-recovery.md
similarity index 81%
rename from app/sdks/web-javascript/docs/examples/account/update-recovery.md
rename to app/sdks/client-web/docs/examples/account/update-recovery.md
index 9c16f06cb5..33cf1b63c9 100644
--- a/app/sdks/web-javascript/docs/examples/account/update-recovery.md
+++ b/app/sdks/client-web/docs/examples/account/update-recovery.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/account/update-verification.md b/app/sdks/client-web/docs/examples/account/update-verification.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/account/update-verification.md
rename to app/sdks/client-web/docs/examples/account/update-verification.md
index f01eeb26db..a80e125e30 100644
--- a/app/sdks/web-javascript/docs/examples/account/update-verification.md
+++ b/app/sdks/client-web/docs/examples/account/update-verification.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/client-web/docs/examples/avatars/get-browser.md b/app/sdks/client-web/docs/examples/avatars/get-browser.md
new file mode 100644
index 0000000000..86d0df4a23
--- /dev/null
+++ b/app/sdks/client-web/docs/examples/avatars/get-browser.md
@@ -0,0 +1,10 @@
+let sdk = new Appwrite();
+
+sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+let result = sdk.avatars.getBrowser('aa');
+
+console.log(result); // Resource URL
diff --git a/app/sdks/client-web/docs/examples/avatars/get-credit-card.md b/app/sdks/client-web/docs/examples/avatars/get-credit-card.md
new file mode 100644
index 0000000000..83a1381adf
--- /dev/null
+++ b/app/sdks/client-web/docs/examples/avatars/get-credit-card.md
@@ -0,0 +1,10 @@
+let sdk = new Appwrite();
+
+sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+let result = sdk.avatars.getCreditCard('amex');
+
+console.log(result); // Resource URL
diff --git a/app/sdks/client-web/docs/examples/avatars/get-favicon.md b/app/sdks/client-web/docs/examples/avatars/get-favicon.md
new file mode 100644
index 0000000000..c0ff93307a
--- /dev/null
+++ b/app/sdks/client-web/docs/examples/avatars/get-favicon.md
@@ -0,0 +1,10 @@
+let sdk = new Appwrite();
+
+sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+let result = sdk.avatars.getFavicon('https://example.com');
+
+console.log(result); // Resource URL
diff --git a/app/sdks/client-web/docs/examples/avatars/get-flag.md b/app/sdks/client-web/docs/examples/avatars/get-flag.md
new file mode 100644
index 0000000000..762aeb348e
--- /dev/null
+++ b/app/sdks/client-web/docs/examples/avatars/get-flag.md
@@ -0,0 +1,10 @@
+let sdk = new Appwrite();
+
+sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+let result = sdk.avatars.getFlag('af');
+
+console.log(result); // Resource URL
diff --git a/app/sdks/client-web/docs/examples/avatars/get-image.md b/app/sdks/client-web/docs/examples/avatars/get-image.md
new file mode 100644
index 0000000000..58f0eb8077
--- /dev/null
+++ b/app/sdks/client-web/docs/examples/avatars/get-image.md
@@ -0,0 +1,10 @@
+let sdk = new Appwrite();
+
+sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+let result = sdk.avatars.getImage('https://example.com');
+
+console.log(result); // Resource URL
diff --git a/app/sdks/client-web/docs/examples/avatars/get-q-r.md b/app/sdks/client-web/docs/examples/avatars/get-q-r.md
new file mode 100644
index 0000000000..fb17032949
--- /dev/null
+++ b/app/sdks/client-web/docs/examples/avatars/get-q-r.md
@@ -0,0 +1,10 @@
+let sdk = new Appwrite();
+
+sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
+ .setProject('5df5acd0d48c2') // Your project ID
+;
+
+let result = sdk.avatars.getQR('[TEXT]');
+
+console.log(result); // Resource URL
diff --git a/app/sdks/web-javascript/docs/examples/database/create-document.md b/app/sdks/client-web/docs/examples/database/create-document.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/database/create-document.md
rename to app/sdks/client-web/docs/examples/database/create-document.md
index 200a752a07..e04f73f73e 100644
--- a/app/sdks/web-javascript/docs/examples/database/create-document.md
+++ b/app/sdks/client-web/docs/examples/database/create-document.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/database/delete-document.md b/app/sdks/client-web/docs/examples/database/delete-document.md
similarity index 81%
rename from app/sdks/web-javascript/docs/examples/database/delete-document.md
rename to app/sdks/client-web/docs/examples/database/delete-document.md
index d40c106ae2..79799b6907 100644
--- a/app/sdks/web-javascript/docs/examples/database/delete-document.md
+++ b/app/sdks/client-web/docs/examples/database/delete-document.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/database/get-document.md b/app/sdks/client-web/docs/examples/database/get-document.md
similarity index 81%
rename from app/sdks/web-javascript/docs/examples/database/get-document.md
rename to app/sdks/client-web/docs/examples/database/get-document.md
index a554fe21b9..b9605dccc6 100644
--- a/app/sdks/web-javascript/docs/examples/database/get-document.md
+++ b/app/sdks/client-web/docs/examples/database/get-document.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/database/list-documents.md b/app/sdks/client-web/docs/examples/database/list-documents.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/database/list-documents.md
rename to app/sdks/client-web/docs/examples/database/list-documents.md
index aab086d8be..14f8a423a1 100644
--- a/app/sdks/web-javascript/docs/examples/database/list-documents.md
+++ b/app/sdks/client-web/docs/examples/database/list-documents.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/database/update-document.md b/app/sdks/client-web/docs/examples/database/update-document.md
similarity index 81%
rename from app/sdks/web-javascript/docs/examples/database/update-document.md
rename to app/sdks/client-web/docs/examples/database/update-document.md
index b299576b93..9104b77a71 100644
--- a/app/sdks/web-javascript/docs/examples/database/update-document.md
+++ b/app/sdks/client-web/docs/examples/database/update-document.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/locale/get-continents.md b/app/sdks/client-web/docs/examples/locale/get-continents.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/locale/get-continents.md
rename to app/sdks/client-web/docs/examples/locale/get-continents.md
index 54bfeee869..1dfdf8013b 100644
--- a/app/sdks/web-javascript/docs/examples/locale/get-continents.md
+++ b/app/sdks/client-web/docs/examples/locale/get-continents.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/locale/get-countries-e-u.md b/app/sdks/client-web/docs/examples/locale/get-countries-e-u.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/locale/get-countries-e-u.md
rename to app/sdks/client-web/docs/examples/locale/get-countries-e-u.md
index 19444cbeb2..6b3f210a1e 100644
--- a/app/sdks/web-javascript/docs/examples/locale/get-countries-e-u.md
+++ b/app/sdks/client-web/docs/examples/locale/get-countries-e-u.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/locale/get-countries-phones.md b/app/sdks/client-web/docs/examples/locale/get-countries-phones.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/locale/get-countries-phones.md
rename to app/sdks/client-web/docs/examples/locale/get-countries-phones.md
index b32ddea06e..f35e2152e4 100644
--- a/app/sdks/web-javascript/docs/examples/locale/get-countries-phones.md
+++ b/app/sdks/client-web/docs/examples/locale/get-countries-phones.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/locale/get-countries.md b/app/sdks/client-web/docs/examples/locale/get-countries.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/locale/get-countries.md
rename to app/sdks/client-web/docs/examples/locale/get-countries.md
index 7ea903cf74..53b96375a1 100644
--- a/app/sdks/web-javascript/docs/examples/locale/get-countries.md
+++ b/app/sdks/client-web/docs/examples/locale/get-countries.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/locale/get-currencies.md b/app/sdks/client-web/docs/examples/locale/get-currencies.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/locale/get-currencies.md
rename to app/sdks/client-web/docs/examples/locale/get-currencies.md
index 56b5ba8a7d..57db66401f 100644
--- a/app/sdks/web-javascript/docs/examples/locale/get-currencies.md
+++ b/app/sdks/client-web/docs/examples/locale/get-currencies.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/locale/get.md b/app/sdks/client-web/docs/examples/locale/get.md
similarity index 78%
rename from app/sdks/web-javascript/docs/examples/locale/get.md
rename to app/sdks/client-web/docs/examples/locale/get.md
index 1358ced165..469a046dbc 100644
--- a/app/sdks/web-javascript/docs/examples/locale/get.md
+++ b/app/sdks/client-web/docs/examples/locale/get.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/storage/create-file.md b/app/sdks/client-web/docs/examples/storage/create-file.md
similarity index 81%
rename from app/sdks/web-javascript/docs/examples/storage/create-file.md
rename to app/sdks/client-web/docs/examples/storage/create-file.md
index 0cfd25a3f0..b23c47027a 100644
--- a/app/sdks/web-javascript/docs/examples/storage/create-file.md
+++ b/app/sdks/client-web/docs/examples/storage/create-file.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/storage/delete-file.md b/app/sdks/client-web/docs/examples/storage/delete-file.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/storage/delete-file.md
rename to app/sdks/client-web/docs/examples/storage/delete-file.md
index 54c3c217c7..c38ab4ba9c 100644
--- a/app/sdks/web-javascript/docs/examples/storage/delete-file.md
+++ b/app/sdks/client-web/docs/examples/storage/delete-file.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/storage/get-file-download.md b/app/sdks/client-web/docs/examples/storage/get-file-download.md
similarity index 72%
rename from app/sdks/web-javascript/docs/examples/storage/get-file-download.md
rename to app/sdks/client-web/docs/examples/storage/get-file-download.md
index 817388b206..ae3a643529 100644
--- a/app/sdks/web-javascript/docs/examples/storage/get-file-download.md
+++ b/app/sdks/client-web/docs/examples/storage/get-file-download.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/storage/get-file-preview.md b/app/sdks/client-web/docs/examples/storage/get-file-preview.md
similarity index 72%
rename from app/sdks/web-javascript/docs/examples/storage/get-file-preview.md
rename to app/sdks/client-web/docs/examples/storage/get-file-preview.md
index 81fd86c4fc..30461e4d9a 100644
--- a/app/sdks/web-javascript/docs/examples/storage/get-file-preview.md
+++ b/app/sdks/client-web/docs/examples/storage/get-file-preview.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/storage/get-file-view.md b/app/sdks/client-web/docs/examples/storage/get-file-view.md
similarity index 71%
rename from app/sdks/web-javascript/docs/examples/storage/get-file-view.md
rename to app/sdks/client-web/docs/examples/storage/get-file-view.md
index c9bd9c3c69..341dd502de 100644
--- a/app/sdks/web-javascript/docs/examples/storage/get-file-view.md
+++ b/app/sdks/client-web/docs/examples/storage/get-file-view.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/storage/get-file.md b/app/sdks/client-web/docs/examples/storage/get-file.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/storage/get-file.md
rename to app/sdks/client-web/docs/examples/storage/get-file.md
index abe4f6993f..a1f94c08a6 100644
--- a/app/sdks/web-javascript/docs/examples/storage/get-file.md
+++ b/app/sdks/client-web/docs/examples/storage/get-file.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/storage/list-files.md b/app/sdks/client-web/docs/examples/storage/list-files.md
similarity index 78%
rename from app/sdks/web-javascript/docs/examples/storage/list-files.md
rename to app/sdks/client-web/docs/examples/storage/list-files.md
index 75e4b1c480..c489a0b46d 100644
--- a/app/sdks/web-javascript/docs/examples/storage/list-files.md
+++ b/app/sdks/client-web/docs/examples/storage/list-files.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/storage/update-file.md b/app/sdks/client-web/docs/examples/storage/update-file.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/storage/update-file.md
rename to app/sdks/client-web/docs/examples/storage/update-file.md
index 32a5afd8aa..2a2f579b3b 100644
--- a/app/sdks/web-javascript/docs/examples/storage/update-file.md
+++ b/app/sdks/client-web/docs/examples/storage/update-file.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/teams/create-membership.md b/app/sdks/client-web/docs/examples/teams/create-membership.md
similarity index 82%
rename from app/sdks/web-javascript/docs/examples/teams/create-membership.md
rename to app/sdks/client-web/docs/examples/teams/create-membership.md
index b2baa405a1..78b2d7fa77 100644
--- a/app/sdks/web-javascript/docs/examples/teams/create-membership.md
+++ b/app/sdks/client-web/docs/examples/teams/create-membership.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/teams/create.md b/app/sdks/client-web/docs/examples/teams/create.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/teams/create.md
rename to app/sdks/client-web/docs/examples/teams/create.md
index 2e7cf60c38..43205ba888 100644
--- a/app/sdks/web-javascript/docs/examples/teams/create.md
+++ b/app/sdks/client-web/docs/examples/teams/create.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/teams/delete-membership.md b/app/sdks/client-web/docs/examples/teams/delete-membership.md
similarity index 80%
rename from app/sdks/web-javascript/docs/examples/teams/delete-membership.md
rename to app/sdks/client-web/docs/examples/teams/delete-membership.md
index a17ad4f009..1b85ef08da 100644
--- a/app/sdks/web-javascript/docs/examples/teams/delete-membership.md
+++ b/app/sdks/client-web/docs/examples/teams/delete-membership.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/teams/delete.md b/app/sdks/client-web/docs/examples/teams/delete.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/teams/delete.md
rename to app/sdks/client-web/docs/examples/teams/delete.md
index 85415016c7..4665ad5773 100644
--- a/app/sdks/web-javascript/docs/examples/teams/delete.md
+++ b/app/sdks/client-web/docs/examples/teams/delete.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/teams/get-memberships.md b/app/sdks/client-web/docs/examples/teams/get-memberships.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/teams/get-memberships.md
rename to app/sdks/client-web/docs/examples/teams/get-memberships.md
index 1ab6bf3ffe..6235ce33f4 100644
--- a/app/sdks/web-javascript/docs/examples/teams/get-memberships.md
+++ b/app/sdks/client-web/docs/examples/teams/get-memberships.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/teams/get.md b/app/sdks/client-web/docs/examples/teams/get.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/teams/get.md
rename to app/sdks/client-web/docs/examples/teams/get.md
index 3e0c4d7fac..f4b0f040b1 100644
--- a/app/sdks/web-javascript/docs/examples/teams/get.md
+++ b/app/sdks/client-web/docs/examples/teams/get.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/teams/list.md b/app/sdks/client-web/docs/examples/teams/list.md
similarity index 78%
rename from app/sdks/web-javascript/docs/examples/teams/list.md
rename to app/sdks/client-web/docs/examples/teams/list.md
index d74fa47e8c..c4229e2400 100644
--- a/app/sdks/web-javascript/docs/examples/teams/list.md
+++ b/app/sdks/client-web/docs/examples/teams/list.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/teams/update-membership-status.md b/app/sdks/client-web/docs/examples/teams/update-membership-status.md
similarity index 82%
rename from app/sdks/web-javascript/docs/examples/teams/update-membership-status.md
rename to app/sdks/client-web/docs/examples/teams/update-membership-status.md
index 25f858ebf8..e8b3de0a0b 100644
--- a/app/sdks/web-javascript/docs/examples/teams/update-membership-status.md
+++ b/app/sdks/client-web/docs/examples/teams/update-membership-status.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/docs/examples/teams/update.md b/app/sdks/client-web/docs/examples/teams/update.md
similarity index 79%
rename from app/sdks/web-javascript/docs/examples/teams/update.md
rename to app/sdks/client-web/docs/examples/teams/update.md
index dedfb63557..bbab80937d 100644
--- a/app/sdks/web-javascript/docs/examples/teams/update.md
+++ b/app/sdks/client-web/docs/examples/teams/update.md
@@ -1,6 +1,7 @@
let sdk = new Appwrite();
sdk
+ .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
diff --git a/app/sdks/web-javascript/package.json b/app/sdks/client-web/package.json
similarity index 95%
rename from app/sdks/web-javascript/package.json
rename to app/sdks/client-web/package.json
index c28785e89f..26dd06fb94 100644
--- a/app/sdks/web-javascript/package.json
+++ b/app/sdks/client-web/package.json
@@ -2,7 +2,7 @@
"name": "appwrite",
"homepage": "https://appwrite.io/support",
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
- "version": "1.0.29",
+ "version": "1.1.0",
"license": "BSD-3-Clause",
"main": "src/sdk.js",
"types": "types/index.d.ts",
diff --git a/app/sdks/web-javascript/src/sdk.js b/app/sdks/client-web/src/sdk.js
similarity index 97%
rename from app/sdks/web-javascript/src/sdk.js
rename to app/sdks/client-web/src/sdk.js
index 4e8f1b0197..0d7a7deaab 100644
--- a/app/sdks/web-javascript/src/sdk.js
+++ b/app/sdks/client-web/src/sdk.js
@@ -103,7 +103,7 @@
globalParams.push({key: key, value: value});
};
- addGlobalHeader('x-sdk-version', 'appwrite:javascript:1.0.29');
+ addGlobalHeader('x-sdk-version', 'appwrite:javascript:1.1.0');
addGlobalHeader('content-type', '');
/**
@@ -712,7 +712,7 @@
* @throws {Error}
* @return {Promise}
*/
- createOAuth2Session: function(provider, success = 'https://localhost:2444/auth/oauth2/success', failure = 'https://localhost:2444/auth/oauth2/failure') {
+ createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure') {
if(provider === undefined) {
throw new Error('Missing required parameter: "provider"');
}
@@ -858,7 +858,7 @@
* @param {number} height
* @param {number} quality
* @throws {Error}
- * @return {Promise}
+ * @return {string}
*/
getBrowser: function(code, width = 100, height = 100, quality = 100) {
if(code === undefined) {
@@ -881,10 +881,11 @@
payload['quality'] = quality;
}
- return http
- .get(path, {
- 'content-type': 'application/json',
- }, payload);
+ payload['project'] = config.project;
+
+ let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
+
+ return config.endpoint + path + ((query) ? '?' + query : '');
},
/**
@@ -900,7 +901,7 @@
* @param {number} height
* @param {number} quality
* @throws {Error}
- * @return {Promise}
+ * @return {string}
*/
getCreditCard: function(code, width = 100, height = 100, quality = 100) {
if(code === undefined) {
@@ -923,10 +924,11 @@
payload['quality'] = quality;
}
- return http
- .get(path, {
- 'content-type': 'application/json',
- }, payload);
+ payload['project'] = config.project;
+
+ let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
+
+ return config.endpoint + path + ((query) ? '?' + query : '');
},
/**
@@ -937,7 +939,7 @@
*
* @param {string} url
* @throws {Error}
- * @return {Promise}
+ * @return {string}
*/
getFavicon: function(url) {
if(url === undefined) {
@@ -952,10 +954,11 @@
payload['url'] = url;
}
- return http
- .get(path, {
- 'content-type': 'application/json',
- }, payload);
+ payload['project'] = config.project;
+
+ let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
+
+ return config.endpoint + path + ((query) ? '?' + query : '');
},
/**
@@ -970,7 +973,7 @@
* @param {number} height
* @param {number} quality
* @throws {Error}
- * @return {Promise}
+ * @return {string}
*/
getFlag: function(code, width = 100, height = 100, quality = 100) {
if(code === undefined) {
@@ -993,10 +996,11 @@
payload['quality'] = quality;
}
- return http
- .get(path, {
- 'content-type': 'application/json',
- }, payload);
+ payload['project'] = config.project;
+
+ let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
+
+ return config.endpoint + path + ((query) ? '?' + query : '');
},
/**
@@ -1011,7 +1015,7 @@
* @param {number} width
* @param {number} height
* @throws {Error}
- * @return {Promise}
+ * @return {string}
*/
getImage: function(url, width = 400, height = 400) {
if(url === undefined) {
@@ -1034,10 +1038,11 @@
payload['height'] = height;
}
- return http
- .get(path, {
- 'content-type': 'application/json',
- }, payload);
+ payload['project'] = config.project;
+
+ let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
+
+ return config.endpoint + path + ((query) ? '?' + query : '');
},
/**
@@ -1051,7 +1056,7 @@
* @param {number} margin
* @param {number} download
* @throws {Error}
- * @return {Promise}
+ * @return {string}
*/
getQR: function(text, size = 400, margin = 1, download = 0) {
if(text === undefined) {
@@ -1078,10 +1083,11 @@
payload['download'] = download;
}
- return http
- .get(path, {
- 'content-type': 'application/json',
- }, payload);
+ payload['project'] = config.project;
+
+ let query = Object.keys(payload).map(key => key + '=' + encodeURIComponent(payload[key])).join('&');
+
+ return config.endpoint + path + ((query) ? '?' + query : '');
}
};
diff --git a/app/sdks/web-javascript/src/sdk.min.js b/app/sdks/client-web/src/sdk.min.js
similarity index 90%
rename from app/sdks/web-javascript/src/sdk.min.js
rename to app/sdks/client-web/src/sdk.min.js
index b2af28282a..113a3402b8 100644
--- a/app/sdks/web-javascript/src/sdk.min.js
+++ b/app/sdks/client-web/src/sdk.min.js
@@ -1,5 +1,5 @@
(function(window){'use strict';window.Appwrite=function(){let config={endpoint:'https://appwrite.io/v1',project:'',locale:'',};let setEndpoint=function(endpoint){config.endpoint=endpoint;return this};let setProject=function(value){http.addGlobalHeader('X-Appwrite-Project',value);config.project=value;return this};let setLocale=function(value){http.addGlobalHeader('X-Appwrite-Locale',value);config.locale=value;return this};let http=function(document){let globalParams=[],globalHeaders=[];let addParam=function(url,param,value){let a=document.createElement('a'),regex=/(?:\?|&|&)+([^=]+)(?:=([^&]*))*/g;let match,str=[];a.href=url;param=encodeURIComponent(param);while(match=regex.exec(a.search))if(param!==match[1])str.push(match[1]+(match[2]?"="+match[2]:""));str.push(param+(value?"="+encodeURIComponent(value):""));a.search=str.join("&");return a.href};let buildQuery=function(params){let str=[];for(let p in params){if(Array.isArray(params[p])){for(let index=0;indexkey+'='+encodeURIComponent(payload[key])).join('&');window.location=config.endpoint+path+((query)?'?'+query:'')},deleteSession:function(sessionId){if(sessionId===undefined){throw new Error('Missing required parameter: "sessionId"')}
@@ -59,26 +59,26 @@ return http.put(path,{'content-type':'application/json',},payload)}};let avatars
let path='/avatars/browsers/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
if(height){payload.height=height}
if(quality){payload.quality=quality}
-return http.get(path,{'content-type':'application/json',},payload)},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
+payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getCreditCard:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
let path='/avatars/credit-cards/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
if(height){payload.height=height}
if(quality){payload.quality=quality}
-return http.get(path,{'content-type':'application/json',},payload)},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
+payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFavicon:function(url){if(url===undefined){throw new Error('Missing required parameter: "url"')}
let path='/avatars/favicon';let payload={};if(url){payload.url=url}
-return http.get(path,{'content-type':'application/json',},payload)},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
+payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getFlag:function(code,width=100,height=100,quality=100){if(code===undefined){throw new Error('Missing required parameter: "code"')}
let path='/avatars/flags/{code}'.replace(new RegExp('{code}','g'),code);let payload={};if(width){payload.width=width}
if(height){payload.height=height}
if(quality){payload.quality=quality}
-return http.get(path,{'content-type':'application/json',},payload)},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
+payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getImage:function(url,width=400,height=400){if(url===undefined){throw new Error('Missing required parameter: "url"')}
let path='/avatars/image';let payload={};if(url){payload.url=url}
if(width){payload.width=width}
if(height){payload.height=height}
-return http.get(path,{'content-type':'application/json',},payload)},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
+payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')},getQR:function(text,size=400,margin=1,download=0){if(text===undefined){throw new Error('Missing required parameter: "text"')}
let path='/avatars/qr';let payload={};if(text){payload.text=text}
if(size){payload.size=size}
if(margin){payload.margin=margin}
if(download){payload.download=download}
-return http.get(path,{'content-type':'application/json',},payload)}};let database={listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$id',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
+payload.project=config.project;let query=Object.keys(payload).map(key=>key+'='+encodeURIComponent(payload[key])).join('&');return config.endpoint+path+((query)?'?'+query:'')}};let database={listDocuments:function(collectionId,filters=[],offset=0,limit=50,orderField='$id',orderType='ASC',orderCast='string',search='',first=0,last=0){if(collectionId===undefined){throw new Error('Missing required parameter: "collectionId"')}
let path='/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}','g'),collectionId);let payload={};if(filters){payload.filters=filters}
if(offset){payload.offset=offset}
if(limit){payload.limit=limit}
diff --git a/app/sdks/console-javascript/tsconfig.json b/app/sdks/client-web/tsconfig.json
similarity index 100%
rename from app/sdks/console-javascript/tsconfig.json
rename to app/sdks/client-web/tsconfig.json
diff --git a/app/sdks/web-javascript/types/index.d.ts b/app/sdks/client-web/types/index.d.ts
similarity index 98%
rename from app/sdks/web-javascript/types/index.d.ts
rename to app/sdks/client-web/types/index.d.ts
index 638f15d2dd..f2bc108bc4 100644
--- a/app/sdks/web-javascript/types/index.d.ts
+++ b/app/sdks/client-web/types/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for appwrite 1.0.29
+// Type definitions for appwrite 1.1.0
// Project: Appwrite
@@ -321,9 +321,9 @@ declare namespace Appwrite {
* @param {number} height
* @param {number} quality
* @throws {Error}
- * @return {Promise}
+ * @return {string}
*/
- getBrowser(code: string, width: number, height: number, quality: number): Promise